var fs = require("fs"); var parse = require("url").parse; var path = require("path"); try { fs.mkdirSync("./tmp"); } catch (e) { if (e.code != "EEXIST") throw e; } function local(url) { return path.join("./tmp", encodeURIComponent(url)); } function read(url) { return fs.createReadStream(local(url)); } module.exports = function(url, callback) { var result = read(url); result.on("error", function(e) { if (e.code != "ENOENT") return callback(e); var options = parse(url); options.rejectUnauthorized = false; require(options.protocol.slice(0, -1)).get(options, function(res) { if (res.statusCode !== 200) return callback(res.statusCode); res.pipe(fs.createWriteStream(local(url))); callback(null, res); }); }).on("open", function() { callback(null, result); }); }; elect> Wojtek's customized Guix
aboutsummaryrefslogtreecommitdiff
path: root/tests/services/linux.scm
AgeCommit message (Expand)Author
2020-08-02services: Add zram-device-service....* gnu/services/linux.scm (<zram-device-configuration>): New record. (zram-device-service-type): New variable. * doc/guix.texi (Linux Services): Document it. * tests/services/linux.scm (zram-swap-device-test): New tests. Efraim Flashner
2020-01-31gnu: Add earlyoom-service-type....* gnu/services/linux.scm: New file. * tests/services/linux.scm: Add test. * Makefile.am (SCM_TESTS): Register test. * doc/guix.texi (Linux Services): Add a new section and document the new service and its configuration. Maxim Cournoyer