Skip to content

use node:protocol, remove legacy readable-stream and remove is-stream microutil #799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ npm install archiver --save
## Quick Start

```js
import fs from "fs";
import fs from "node:fs";
import { ZipArchive } from "archiver";

// create a file to stream archive data to.
2 changes: 1 addition & 1 deletion benchmark/simple/pack-zip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var fs = require("fs");
var fs = require("node:fs");

var mkdir = require("mkdirp");
var streamBench = require("stream-bench");
2 changes: 1 addition & 1 deletion examples/pack-tar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var fs = require("fs");
var fs = require("node:fs");

var archiver = require("archiver");

2 changes: 1 addition & 1 deletion examples/pack-tgz.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var fs = require("fs");
var fs = require("node:fs");
var archiver = require("archiver");

var output = fs.createWriteStream(__dirname + "/example-output.tar.gz");
2 changes: 1 addition & 1 deletion examples/pack-zip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var fs = require("fs");
var fs = require("node:fs");

var archiver = require("archiver");

4 changes: 2 additions & 2 deletions examples/progress.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var archiver = require("../");
var tmp = require("os").tmpdir();
var tmp = require("node:os").tmpdir();
var async = require("async");
var fs = require("fs");
var fs = require("node:fs");

// You can change this by something bigger!
var directory = __dirname + "/fixtures";
6 changes: 3 additions & 3 deletions lib/core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createReadStream, lstat, readlinkSync, Stats } from "fs";
import { isStream } from "is-stream";
import { createReadStream, lstat, readlinkSync, Stats } from "node:fs";
import { isStream } from "./utils.js";
import readdirGlob from "readdir-glob";
import { Readable } from "lazystream";
import { queue } from "async";
@@ -9,7 +9,7 @@ import {
resolve as resolvePath,
} from "path";
import { ArchiverError } from "./error.js";
import { Transform } from "readable-stream";
import { Transform } from "node:stream";
import {
dateify,
normalizeInputSource,
2 changes: 1 addition & 1 deletion lib/error.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import util from "util";
import util from "node:util";

const ERROR_CODES = {
ABORTED: "archive was aborted",
2 changes: 1 addition & 1 deletion lib/plugins/json.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Transform } from "readable-stream";
import { Transform } from "node:stream";
import crc32 from "buffer-crc32";
import { collectStream } from "../utils.js";

2 changes: 1 addition & 1 deletion lib/plugins/tar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import zlib from "zlib";
import zlib from "node:zlib";
import engine from "tar-stream";
import { collectStream } from "../utils.js";

9 changes: 7 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import normalizePath from "normalize-path";
import { PassThrough } from "readable-stream";
import { isStream } from "is-stream";
import { PassThrough } from "node:stream";

export function collectStream(source, callback) {
var collection = [];
@@ -64,3 +63,9 @@ export function sanitizePath(filepath) {
export function trailingSlashIt(str) {
return str.slice(-1) !== "/" ? str + "/" : str;
}

export function isStream(stream) {
return stream !== null
&& typeof stream === 'object'
&& typeof stream.pipe === 'function';
}
19 changes: 1 addition & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -31,10 +31,8 @@
"dependencies": {
"async": "^3.2.4",
"buffer-crc32": "^1.0.0",
"is-stream": "^3.0.0",
"lazystream": "^1.0.0",
"normalize-path": "^3.0.0",
"readable-stream": "^4.0.0",
"readdir-glob": "^1.1.3",
"tar-stream": "^3.0.0",
"zip-stream": "^7.0.2"
5 changes: 2 additions & 3 deletions test/archiver.js
Original file line number Diff line number Diff line change
@@ -7,9 +7,8 @@ import {
symlinkSync,
unlinkSync,
writeFileSync,
} from "fs";
import { PassThrough } from "readable-stream";
import { Readable } from "readable-stream";
} from "node:fs";
import { Readable } from "node:stream";
import { assert } from "chai";
import { mkdirp } from "mkdirp";
import {
9 changes: 4 additions & 5 deletions test/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import crypto from "crypto";
import { readFileSync, WriteStream } from "fs";
import { inherits } from "util";
import { Stream } from "stream";
import { Readable, Writable } from "readable-stream";
import crypto from "node:crypto";
import { readFileSync, WriteStream } from "node:fs";
import { inherits } from "node:util";
import { Stream, Readable, Writable } from "node:stream";

export function adjustDateByOffset(d, offset) {
d = d instanceof Date ? d : new Date();
2 changes: 1 addition & 1 deletion test/plugins.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import {
unlinkSync,
writeFileSync,
WriteStream,
} from "fs";
} from "node:fs";
import { assert } from "chai";
import { mkdirp } from "mkdirp";
import tar from "tar";
2 changes: 1 addition & 1 deletion website/docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ Archiver is available on [npm](https://www.npmjs.com/package/archiver).

```js
// require modules
const fs = require("fs");
const fs = require("node:fs");
const archiver = require("archiver");

// create a file to stream archive data to.