Socket
Socket
Sign inDemoInstall

@chartiq/vinyl-tar

Package Overview
Dependencies
28
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @chartiq/vinyl-tar

vinyl binding for tar-stream


Version published
Weekly downloads
44
decreased by-16.98%
Maintainers
4
Install size
721 kB
Created
Weekly downloads
 

Readme

Source

@chartiq/vinyl-tar

Create a tarball from a vinyl stream. Extract a tarball as a vinyl stream source.

install

npm install --save @chartiq/vinyl-tar

pack

Creates a tarball from a vinyl stream. Acts like a vinyl adapter's destination stream.

const {pack} = require('@chartiq/vinyl-tar');
const fs = require('fs');
const through = require('through2');
const vfs = require('vinyl-fs');

vfs.src('**/*.txt')
	.pipe(through.obj((file, enc, next) => {
		const str = file.contents.toString();

		file.contents = Buffer.from(str.toUpperCase());

		next(null, file);
	}))
	.pipe(pack())
	.pipe(fs.createWriteStream('./uppercase.tar'));

extract

Emits each entry of the tarball as a vinyl object. Acts like a vinyl adapter's source stream.

const {extract} = require('@chartiq/vinyl-tar');
const fs = require('fs');
const through = require('through2');
const vfs = require('vinyl-fs');

fs.createReadStream('./files.tar')
	.pipe(extract())
	.pipe(through.obj((file, enc, next) => {
		if (file.stat.isBuffer() && file.stat.size > 1024) {
			next(null, file);
		} else {
			next(null);
		}
	}))
	.pipe(vfs.dest('files'));

FAQs

Last updated on 19 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc