How to use the tar-fs.pack function in tar-fs

To help you get started, we’ve selected a few tar-fs 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 exoframejs / exoframe-server / test / deploy.js View on Github external
new Promise(async resolve => {
    // create tar streams
    const streamDocker = tar.pack(path.join(__dirname, 'fixtures', 'docker-project'));
    const streamNode = tar.pack(path.join(__dirname, 'fixtures', 'node-project'));
    const streamHtml = tar.pack(path.join(__dirname, 'fixtures', 'html-project'));
    const streamHtmlUpdate = tar.pack(path.join(__dirname, 'fixtures', 'html-project'));
    const streamCompose = tar.pack(path.join(__dirname, 'fixtures', 'compose-project'));
    const streamComposeUpdate = tar.pack(path.join(__dirname, 'fixtures', 'compose-project'));
    const streamBrokenDocker = tar.pack(path.join(__dirname, 'fixtures', 'broken-docker-project'));
    const streamBrokenNode = tar.pack(path.join(__dirname, 'fixtures', 'broken-node-project'));

    // options base
    const optionsBase = {
      method: 'POST',
      url: '/deploy',
      headers: {
        Authorization: `Bearer ${token}`,
      },
    };
github nocproject / noc / ui / web / builder / src / index.js View on Github external
.forEach(value => {
                    const file = value.name.replace(/{hash}/, value.hash);
                    content = content.replace(value.name, file);
                });
                // add hash to theme specific files
                themes.forEach(theme => {
                    const appHash = hash(values,'bundle_app_{hash}', theme);
                    const vendorHash = hash(values, 'bundle_vendor_{hash}', theme);
                    let body;
                    body = template.replace(/{theme}/g, theme);
                    body = body.replace(/{app_hash}/, appHash);
                    themeSpecific.push(body.replace(/{vendor_hash}/, vendorHash));
                });
                content = content.replace(/{theme_specific}/, themeSpecific.join('\n'));
                writeDesktop(content);
                tar.pack(distDir).pipe(zlib.createGzip()).pipe(output);
                console.log('Done');
            },
            error => {
github balena-io / balena-preload / lib / preload.js View on Github external
_build () {
    const files = ['Dockerfile', 'requirements.txt', 'src/preload.py']
    const name = 'Building Docker preloader image.'
    this._progress(name, 0)

    const tarStream = tarfs.pack(path.resolve(__dirname, '..'), { entries: files })
    return this.docker.buildImage(tarStream, { t: DOCKER_IMAGE_TAG })
    .then((build) => {
      return new Promise((resolve, reject) => {
        this.docker.modem.followProgress(
          build,
          (error, output) => {  // onFinished
            if (error) {
              reject(error)
            } else {
              this._progress(name, 100)
              resolve()
            }
          },
          (event) => {  // onProgress
            if (event.stream) {
              const matches = event.stream.match(DOCKER_STEP_RE)
github staticland / staticland-api / tests / server.js View on Github external
test('deploy', function (t) {
  var tarstream = tar.pack(path.join(__dirname, 'example-site'))
  var options = { domain: 'hi.com', authorization: `Bearer ${token}` }
  staticland.deploy(tarstream, options, function (err, res, body) {
    t.notOk(err)
    t.ok(res)
    t.ok(body)
    t.end()
  })
})
github testcontainers / testcontainers-node / src / docker-client.ts View on Github external
public async buildImage(repoTag: RepoTag, context: BuildContext, buildArgs: BuildArgs): Promise {
    log.info(`Building image '${repoTag.toString()}' with context '${context}'`);

    const tarStream = tar.pack(context);
    const stream = await this.dockerode.buildImage(tarStream, {
      buildargs: buildArgs,
      t: repoTag.toString()
    });
    await streamToArray(stream);
  }
github steffenmllr / docker-butler / lib / butler.js View on Github external
return new Promise(function (resolve, reject) {
        self._docker.buildImage(Tar.pack(self._dirPath), {t: self.config.tag}, function (err, stream){
            if(err) { return reject(err); }
            stream.on('end', function () {
                self.log('Build Image with Tag: ' + self.config.tag);
                resolve();
            });
            stream.on('data', function (data) {
                try {
                    var output = JSON.parse(data.toString());
                    if(output.stream) {
                        self.log(output.stream);
                    }
                } catch (e) {
                }

            });
        });
github prebuild / prebuildify / index.js View on Github external
function copyRecursive (src, dst, cb) {
  pump(tar.pack(src), tar.extract(dst), cb)
}

tar-fs

filesystem bindings for tar-stream

MIT
Latest version published 6 months ago

Package Health Score

79 / 100
Full package analysis

Popular tar-fs functions