This package has been deprecated

Author message:

use tar-vinyl-stream instead

tar-vinyl

1.0.0 • Public • Published

tar-vinyl

tar-vinyl exposes two streams, pack and extract.

Pack

The pack stream consumes a stream of vinyl objects and generates a tar file stream.

import {pack} from 'tar-vinyl';
import * as fs from 'fs';
import gulp from 'gulp';
import debug from 'gulp-debug';

gulp.src('./src/*.js')
	.pipe(debug())
	.pipe(pack())
	.pipe(fs.createWriteStream('./my-files.tar'));

Extract

The extract stream consumes a tar stream and emits vinyl objects for each containing file.

import {extract} from 'tar-vinyl';
import * as fs from 'fs';
import gulp from 'gulp';
import debug from 'gulp-debug';

fs.createReadStream('./my-files.tar')
	.pipe(extract())
	.pipe(debug())
	.pipe(...) // use gulp plugins
	.pipe(gulp.dest('./my-tar'));

extract also exposes the tar header. You can use it for any purpose, eg filtering the files:

import {extract} from 'tar-vinyl';
import * as fs from 'fs';
import gulp from 'gulp';
import debug from 'gulp-debug';
import filter from 'through2-filter';

fs.createReadStream('./my-files.tar')
	.pipe(extract())
	.pipe(debug())
	// allow only files & directories
	.pipe(filter.obj(f => ['file', 'directory'].indexOf(f.tarHeader.type) !== -1))
	.pipe(debug())
	.pipe(gulp.dest('./dest'));

Readme

Keywords

none

Package Sidebar

Install

npm i tar-vinyl

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • chpio