UNPKG

689 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const fs = require("fs-extra");
4const path_1 = require("./path");
5const deps = {
6 m: {},
7 get tar() { return this.m.tar = this.m.tar || require('tar-fs'); },
8};
9exports.tar = {
10 gz: {
11 pack(from, to, options = {}) {
12 const _from = path_1.join(from);
13 const _to = path_1.join(to);
14 return new Promise((resolve, reject) => {
15 deps.tar
16 .pack(_from, options)
17 .pipe(fs.createWriteStream(_to))
18 .on('error', reject)
19 .on('finish', resolve);
20 });
21 }
22 }
23};