How to use the split-file.splitFileBySize function in split-file

To help you get started, we’ve selected a few split-file examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jkrup / meteor-now / src / app.js View on Github external
await new Promise((resolve, reject) => {
    splitFile.splitFileBySize(`.meteor/local/builds/${dockerfile.buildzip}`, 999999, async (err, names) => {
      if (err) {
        reject(err);
      }
      // delete original bundle file so that it doesnt get uploaded to now
      await del.promise([`.meteor/local/builds/${dockerfile.buildzip}`]);
      resolve(names);
    });
  });
};
github psychokinesis-dev / free-share / app / file-store.js View on Github external
fs.createReadStream(filePath).pipe(fs.createWriteStream(dest)).on('finish', () => {
                splitFile.splitFileBySize(dest, 1024 * 1024)
                    .then((files) => {
                        async.map(files, (file, cb) => {
                            md5File(file, (err, hash) => {
                                if (err) {
                                    return cb(err);
                                }

                                const finalFilePath = path.join(storeDir, hash);
                                fs.rename(file, finalFilePath, (err) => {
                                    if (err) {
                                        return cb(err);
                                    }

                                    cb(null, {
                                        path: finalFilePath,
                                        name: hash
github jkrup / meteor-now / src / api / files.js View on Github external
export const prepareBundle = async () => {
  const bundlePath = `${meteorNowBuildPath}/${tarFileName}`;
  await tar.x({
    file: bundlePath,
    cwd: meteorNowBuildPath,
  }, ['bundle/programs/server/package.json']);

  try {
    if (getArg('nosplit')) {
      renameFile(bundlePath, `${meteorNowBuildPath}/bundle.tar.gz`);
    } else {
      logger.debug('splitting bundle');
      await splitFile.splitFileBySize(
        `${meteorNowBuildPath}/${tarFileName}`,
        999999,
      );
      await deletePath(bundlePath);
    }
  } catch (e) {
    logger.error(e);
  }
};

split-file

Splitting and merging files with NodeJS

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular split-file functions