MCPcopy Index your code
hub / github.com/totaljs/framework / makebundle

Function makebundle

index.js:4143–4185  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4141 var bundledir = F.path.root(CONF.directory_bundles);
4142
4143 var makebundle = function() {
4144
4145 var arr = Fs.readdirSync(bundledir);
4146 var url = [];
4147
4148 for (var i = 0; i < arr.length; i++) {
4149 if (arr[i].endsWith('.url'))
4150 url.push(arr[i]);
4151 }
4152
4153 url.wait(function(item, next) {
4154
4155 var filename = F.path.root(CONF.directory_bundles) + item.replace('.url', '.bundle');
4156 var link = Fs.readFileSync(F.path.root(CONF.directory_bundles) + item).toString('utf8');
4157
4158 F.consoledebug('Download bundle: ' + link);
4159
4160 U.download(link, FLAGS_INSTALL, function(err, response) {
4161
4162 if (err) {
4163 F.error(err, 'Bundle: ' + link);
4164 next();
4165 return;
4166 }
4167
4168 var stream = Fs.createWriteStream(filename);
4169
4170 response.pipe(stream);
4171 response.on('error', function(err) {
4172 F.error(err, 'Bundle: ' + link);
4173 next();
4174 });
4175
4176 CLEANUP(stream, next);
4177 });
4178
4179 }, function() {
4180 require('./bundles').make(function() {
4181 F.directory = HEADERS.workers.cwd = directory = F.path.root(CONF.directory_src);
4182 callback();
4183 });
4184 });
4185 };
4186
4187 try {
4188 Fs.statSync(bundledir);

Callers 1

index.jsFile · 0.85

Calls 2

callbackFunction · 0.85
nextFunction · 0.70

Tested by

no test coverage detected