@js-utils-kit/fs 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`fs`);c=s(c);let l=require(`path`);l=s(l);let u=require(`archiver`);u=s(u);function d({format:e,source:t,destination:n,options:r={},log:i=!0,onSuccess:a}){let o=l.default.resolve(t);if(!c.default.existsSync(o)||!c.default.statSync(o).isDirectory())throw Error(`Source directory "${t}" does not exist or is not a directory.`);let s=c.default.createWriteStream(n);e===`zip`&&(r={...r,zlib:{level:9}});let d=(0,u.default)(e,r);return new Promise((e,r)=>{s.on(`close`,()=>{let t=d.pointer();i&&console.log(`${n} created: ${t} total bytes`),a&&a(t),e()}),d.on(`error`,e=>{r(e)}),d.pipe(s),d.directory(t,!1),d.finalize().catch(e=>r(e instanceof Error?e:Error(String(e))))})}exports.createArchive=d;var f=require(`@js-utils-kit/types`);Object.keys(f).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return f[e]}})});
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`fs`);c=s(c);let l=require(`path`);l=s(l);let u=require(`archiver`);u=s(u);function d({format:e,source:t,destination:n,options:r={},log:i=!0,onSuccess:a}){let o=l.default.resolve(t);if(!c.default.existsSync(o)||!c.default.statSync(o).isDirectory())throw Error(`Source directory "${t}" does not exist or is not a directory.`);let s=c.default.createWriteStream(n);e===`zip`&&(r={...r,zlib:{level:9}});let d=(0,u.default)(e,r);return new Promise((e,r)=>{s.on(`close`,()=>{let t=d.pointer();i&&console.log(`${n} created: ${t} total bytes`),a&&a(t),e()}),d.on(`error`,e=>{r(e)}),d.pipe(s),d.directory(t,!1),d.finalize().catch(e=>r(e instanceof Error?e:Error(String(e))))})}exports.createArchive=d;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { CreateArchiveOptions } from "@js-utils-kit/types";
2
- export * from "@js-utils-kit/types";
3
2
 
4
3
  //#region src/createArchive.d.ts
5
-
6
4
  /**
7
5
  * Creates a {@link ArchiveFormat } archive from a specified directory.
8
6
  *
package/dist/index.d.mts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { CreateArchiveOptions } from "@js-utils-kit/types";
2
- export * from "@js-utils-kit/types";
3
2
 
4
3
  //#region src/createArchive.d.ts
5
-
6
4
  /**
7
5
  * Creates a {@link ArchiveFormat } archive from a specified directory.
8
6
  *
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import e from"fs";import t from"path";import n from"archiver";export*from"@js-utils-kit/types";function r({format:r,source:i,destination:a,options:o={},log:s=!0,onSuccess:c}){let l=t.resolve(i);if(!e.existsSync(l)||!e.statSync(l).isDirectory())throw Error(`Source directory "${i}" does not exist or is not a directory.`);let u=e.createWriteStream(a);r===`zip`&&(o={...o,zlib:{level:9}});let d=n(r,o);return new Promise((e,t)=>{u.on(`close`,()=>{let t=d.pointer();s&&console.log(`${a} created: ${t} total bytes`),c&&c(t),e()}),d.on(`error`,e=>{t(e)}),d.pipe(u),d.directory(i,!1),d.finalize().catch(e=>t(e instanceof Error?e:Error(String(e))))})}export{r as createArchive};
1
+ import e from"fs";import t from"path";import n from"archiver";function r({format:r,source:i,destination:a,options:o={},log:s=!0,onSuccess:c}){let l=t.resolve(i);if(!e.existsSync(l)||!e.statSync(l).isDirectory())throw Error(`Source directory "${i}" does not exist or is not a directory.`);let u=e.createWriteStream(a);r===`zip`&&(o={...o,zlib:{level:9}});let d=n(r,o);return new Promise((e,t)=>{u.on(`close`,()=>{let t=d.pointer();s&&console.log(`${a} created: ${t} total bytes`),c&&c(t),e()}),d.on(`error`,e=>{t(e)}),d.pipe(u),d.directory(i,!1),d.finalize().catch(e=>t(e instanceof Error?e:Error(String(e))))})}export{r as createArchive};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@js-utils-kit/fs",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "File system utilities",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -30,13 +30,13 @@
30
30
  "types": "./dist/index.d.cts",
31
31
  "exports": {
32
32
  ".": {
33
- "import": "./dist/index.mjs",
34
- "require": "./dist/index.cjs"
33
+ "require": "./dist/index.cjs",
34
+ "import": "./dist/index.mjs"
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
38
  "archiver": "^7.0.1",
39
- "@js-utils-kit/types": "1.0.0"
39
+ "@js-utils-kit/types": "1.2.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsdown",