Skip to content

Commit

Permalink
remove archiver-utils dep (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctalkington authored Oct 16, 2024
1 parent 8c1c4dc commit 03747dd
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 203 deletions.
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ZipArchiveOutputStream, ZipArchiveEntry } from "compress-commons";
import util from "archiver-utils";
import { dateify, sanitizePath } from "./utils.js";

/**
* ZipStream
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class ZipStream extends ZipArchiveOutputStream {
* @return {Object}
*/
_normalizeFileData(data) {
data = util.defaults(data, {
data = {
type: "file",
name: null,
namePrependSlash: this.options.namePrependSlash,
Expand All @@ -63,11 +63,12 @@ export default class ZipStream extends ZipArchiveOutputStream {
mode: null,
store: this.options.store,
comment: "",
});
...data,
};
var isDir = data.type === "directory";
var isSymlink = data.type === "symlink";
if (data.name) {
data.name = util.sanitizePath(data.name);
data.name = sanitizePath(data.name);
if (!isSymlink && data.name.slice(-1) === "/") {
isDir = true;
data.type = "directory";
Expand All @@ -78,7 +79,7 @@ export default class ZipStream extends ZipArchiveOutputStream {
if (isDir || isSymlink) {
data.store = true;
}
data.date = util.dateify(data.date);
data.date = dateify(data.date);
return data;
}

Expand Down
Loading

0 comments on commit 03747dd

Please sign in to comment.