@datastream/file 0.0.9 → 0.0.11

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/index.node.cjs CHANGED
@@ -25,11 +25,11 @@ module.exports = __toCommonJS(index_node_exports);
25
25
  var import_node_path = require("node:path");
26
26
  var import_node_fs = require("node:fs");
27
27
  var import_core = require("@datastream/core");
28
- const fileReadStream = async ({ path, types }, streamOptions) => {
28
+ const fileReadStream = ({ path, types }, streamOptions) => {
29
29
  enforceType(path, types);
30
30
  return (0, import_node_fs.createReadStream)(path, (0, import_core.makeOptions)(streamOptions));
31
31
  };
32
- const fileWriteStream = async ({ path, types }, streamOptions) => {
32
+ const fileWriteStream = ({ path, types }, streamOptions) => {
33
33
  enforceType(path, types);
34
34
  return (0, import_node_fs.createWriteStream)(path, (0, import_core.makeOptions)(streamOptions));
35
35
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.node.js"],
4
- "sourcesContent": ["import { extname } from 'node:path'\nimport { createReadStream, createWriteStream } from 'node:fs'\nimport { makeOptions } from '@datastream/core'\n\nexport const fileReadStream = async ({ path, types }, streamOptions) => {\n enforceType(path, types)\n return createReadStream(path, makeOptions(streamOptions))\n}\n\nexport const fileWriteStream = async ({ path, types }, streamOptions) => {\n enforceType(path, types)\n return createWriteStream(path, makeOptions(streamOptions))\n}\n\nconst enforceType = (path, types = []) => {\n const pathExt = extname(path)\n for (const type of types) {\n for (const mime in type.accept) {\n for (const ext of type.accept[mime]) {\n if (pathExt === ext) {\n return\n }\n }\n }\n }\n if (types.length) {\n throw new Error('invalid extension')\n }\n}\n\nexport default {\n readStream: fileReadStream,\n writeStream: fileWriteStream\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,qBAAoD;AACpD,kBAA4B;AAErB,MAAM,iBAAiB,OAAO,EAAE,MAAM,MAAM,GAAG,kBAAkB;AACtE,cAAY,MAAM,KAAK;AACvB,aAAO,iCAAiB,UAAM,yBAAY,aAAa,CAAC;AAC1D;AAEO,MAAM,kBAAkB,OAAO,EAAE,MAAM,MAAM,GAAG,kBAAkB;AACvE,cAAY,MAAM,KAAK;AACvB,aAAO,kCAAkB,UAAM,yBAAY,aAAa,CAAC;AAC3D;AAEA,MAAM,cAAc,CAAC,MAAM,QAAQ,CAAC,MAAM;AACxC,QAAM,cAAU,0BAAQ,IAAI;AAC5B,aAAW,QAAQ,OAAO;AACxB,eAAW,QAAQ,KAAK,QAAQ;AAC9B,iBAAW,OAAO,KAAK,OAAO,OAAO;AACnC,YAAI,YAAY,KAAK;AACnB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,MAAI,MAAM,QAAQ;AAChB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AACF;AAEA,IAAO,qBAAQ;AAAA,EACb,YAAY;AAAA,EACZ,aAAa;AACf;",
4
+ "sourcesContent": ["import { extname } from 'node:path'\nimport { createReadStream, createWriteStream } from 'node:fs'\nimport { makeOptions } from '@datastream/core'\n\nexport const fileReadStream = ({ path, types }, streamOptions) => {\n enforceType(path, types)\n return createReadStream(path, makeOptions(streamOptions))\n}\n\nexport const fileWriteStream = ({ path, types }, streamOptions) => {\n enforceType(path, types)\n return createWriteStream(path, makeOptions(streamOptions))\n}\n\nconst enforceType = (path, types = []) => {\n const pathExt = extname(path)\n for (const type of types) {\n for (const mime in type.accept) {\n for (const ext of type.accept[mime]) {\n if (pathExt === ext) {\n return\n }\n }\n }\n }\n if (types.length) {\n throw new Error('invalid extension')\n }\n}\n\nexport default {\n readStream: fileReadStream,\n writeStream: fileWriteStream\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,qBAAoD;AACpD,kBAA4B;AAErB,MAAM,iBAAiB,CAAC,EAAE,MAAM,MAAM,GAAG,kBAAkB;AAChE,cAAY,MAAM,KAAK;AACvB,aAAO,iCAAiB,UAAM,yBAAY,aAAa,CAAC;AAC1D;AAEO,MAAM,kBAAkB,CAAC,EAAE,MAAM,MAAM,GAAG,kBAAkB;AACjE,cAAY,MAAM,KAAK;AACvB,aAAO,kCAAkB,UAAM,yBAAY,aAAa,CAAC;AAC3D;AAEA,MAAM,cAAc,CAAC,MAAM,QAAQ,CAAC,MAAM;AACxC,QAAM,cAAU,0BAAQ,IAAI;AAC5B,aAAW,QAAQ,OAAO;AACxB,eAAW,QAAQ,KAAK,QAAQ;AAC9B,iBAAW,OAAO,KAAK,OAAO,OAAO;AACnC,YAAI,YAAY,KAAK;AACnB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,MAAI,MAAM,QAAQ;AAChB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AACF;AAEA,IAAO,qBAAQ;AAAA,EACb,YAAY;AAAA,EACZ,aAAa;AACf;",
6
6
  "names": []
7
7
  }
package/index.node.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { extname } from "node:path";
2
2
  import { createReadStream, createWriteStream } from "node:fs";
3
3
  import { makeOptions } from "@datastream/core";
4
- const fileReadStream = async ({ path, types }, streamOptions) => {
4
+ const fileReadStream = ({ path, types }, streamOptions) => {
5
5
  enforceType(path, types);
6
6
  return createReadStream(path, makeOptions(streamOptions));
7
7
  };
8
- const fileWriteStream = async ({ path, types }, streamOptions) => {
8
+ const fileWriteStream = ({ path, types }, streamOptions) => {
9
9
  enforceType(path, types);
10
10
  return createWriteStream(path, makeOptions(streamOptions));
11
11
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.node.js"],
4
- "sourcesContent": ["import { extname } from 'node:path'\nimport { createReadStream, createWriteStream } from 'node:fs'\nimport { makeOptions } from '@datastream/core'\n\nexport const fileReadStream = async ({ path, types }, streamOptions) => {\n enforceType(path, types)\n return createReadStream(path, makeOptions(streamOptions))\n}\n\nexport const fileWriteStream = async ({ path, types }, streamOptions) => {\n enforceType(path, types)\n return createWriteStream(path, makeOptions(streamOptions))\n}\n\nconst enforceType = (path, types = []) => {\n const pathExt = extname(path)\n for (const type of types) {\n for (const mime in type.accept) {\n for (const ext of type.accept[mime]) {\n if (pathExt === ext) {\n return\n }\n }\n }\n }\n if (types.length) {\n throw new Error('invalid extension')\n }\n}\n\nexport default {\n readStream: fileReadStream,\n writeStream: fileWriteStream\n}\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AACxB,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,mBAAmB;AAErB,MAAM,iBAAiB,OAAO,EAAE,MAAM,MAAM,GAAG,kBAAkB;AACtE,cAAY,MAAM,KAAK;AACvB,SAAO,iBAAiB,MAAM,YAAY,aAAa,CAAC;AAC1D;AAEO,MAAM,kBAAkB,OAAO,EAAE,MAAM,MAAM,GAAG,kBAAkB;AACvE,cAAY,MAAM,KAAK;AACvB,SAAO,kBAAkB,MAAM,YAAY,aAAa,CAAC;AAC3D;AAEA,MAAM,cAAc,CAAC,MAAM,QAAQ,CAAC,MAAM;AACxC,QAAM,UAAU,QAAQ,IAAI;AAC5B,aAAW,QAAQ,OAAO;AACxB,eAAW,QAAQ,KAAK,QAAQ;AAC9B,iBAAW,OAAO,KAAK,OAAO,OAAO;AACnC,YAAI,YAAY,KAAK;AACnB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,MAAI,MAAM,QAAQ;AAChB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AACF;AAEA,IAAO,qBAAQ;AAAA,EACb,YAAY;AAAA,EACZ,aAAa;AACf;",
4
+ "sourcesContent": ["import { extname } from 'node:path'\nimport { createReadStream, createWriteStream } from 'node:fs'\nimport { makeOptions } from '@datastream/core'\n\nexport const fileReadStream = ({ path, types }, streamOptions) => {\n enforceType(path, types)\n return createReadStream(path, makeOptions(streamOptions))\n}\n\nexport const fileWriteStream = ({ path, types }, streamOptions) => {\n enforceType(path, types)\n return createWriteStream(path, makeOptions(streamOptions))\n}\n\nconst enforceType = (path, types = []) => {\n const pathExt = extname(path)\n for (const type of types) {\n for (const mime in type.accept) {\n for (const ext of type.accept[mime]) {\n if (pathExt === ext) {\n return\n }\n }\n }\n }\n if (types.length) {\n throw new Error('invalid extension')\n }\n}\n\nexport default {\n readStream: fileReadStream,\n writeStream: fileWriteStream\n}\n"],
5
+ "mappings": "AAAA,SAAS,eAAe;AACxB,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,mBAAmB;AAErB,MAAM,iBAAiB,CAAC,EAAE,MAAM,MAAM,GAAG,kBAAkB;AAChE,cAAY,MAAM,KAAK;AACvB,SAAO,iBAAiB,MAAM,YAAY,aAAa,CAAC;AAC1D;AAEO,MAAM,kBAAkB,CAAC,EAAE,MAAM,MAAM,GAAG,kBAAkB;AACjE,cAAY,MAAM,KAAK;AACvB,SAAO,kBAAkB,MAAM,YAAY,aAAa,CAAC;AAC3D;AAEA,MAAM,cAAc,CAAC,MAAM,QAAQ,CAAC,MAAM;AACxC,QAAM,UAAU,QAAQ,IAAI;AAC5B,aAAW,QAAQ,OAAO;AACxB,eAAW,QAAQ,KAAK,QAAQ;AAC9B,iBAAW,OAAO,KAAK,OAAO,OAAO;AACnC,YAAI,YAAY,KAAK;AACnB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,MAAI,MAAM,QAAQ;AAChB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AACF;AAEA,IAAO,qBAAQ;AAAA,EACb,YAAY;AAAA,EACZ,aAAa;AACf;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datastream/file",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "engines": {
@@ -66,7 +66,7 @@
66
66
  "homepage": "https://datastream.js.org",
67
67
  "dependencies": {
68
68
  "@datastream/core": "0.0.5",
69
- "@datastream/file": "0.0.9"
69
+ "@datastream/file": "0.0.11"
70
70
  },
71
- "gitHead": "473006509375557fcc025ad076d827c0d3c2e4ee"
71
+ "gitHead": "28b7eb8cfb09381e5136122ac7eb13cadac8e579"
72
72
  }