convert-buddy-js 0.2.0 → 0.3.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/README.md +1 -1
- package/dist/{chunk-B44HYXEP.js → chunk-27H3T556.js} +11 -3
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -2
- package/package.json +1 -1
- package/dist/chunk-VUNV25KB.js +0 -16
- package/dist/fxp-TCYZYIHZ.js +0 -1701
- package/dist/papaparse-4KNMW7KX.js +0 -1324
- package/dist/src-YEKAFGYK.js +0 -3001
- package/dist/sync-FQGEFK5M.js +0 -1492
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ console.log(buddy.stats());
|
|
|
48
48
|
import { createNodeTransform } from "convert-buddy-js";
|
|
49
49
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
50
50
|
|
|
51
|
-
const transform = createNodeTransform({
|
|
51
|
+
const transform = await createNodeTransform({
|
|
52
52
|
inputFormat: "csv",
|
|
53
53
|
outputFormat: "ndjson",
|
|
54
54
|
csvConfig: { hasHeaders: true },
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { Transform } from "stream";
|
|
3
2
|
async function loadWasmModule() {
|
|
4
3
|
const isNode = typeof process !== "undefined" && !!process.versions?.node;
|
|
5
4
|
if (isNode) {
|
|
@@ -56,9 +55,18 @@ var ConvertBuddy = class _ConvertBuddy {
|
|
|
56
55
|
return this.converter.getStats();
|
|
57
56
|
}
|
|
58
57
|
};
|
|
59
|
-
function
|
|
58
|
+
async function loadNodeTransform() {
|
|
59
|
+
const isNode = typeof process !== "undefined" && !!process.versions?.node;
|
|
60
|
+
if (!isNode) {
|
|
61
|
+
throw new Error("createNodeTransform is only available in Node.js runtimes.");
|
|
62
|
+
}
|
|
63
|
+
const streamModule = await import("stream");
|
|
64
|
+
return streamModule.Transform;
|
|
65
|
+
}
|
|
66
|
+
async function createNodeTransform(opts = {}) {
|
|
60
67
|
let buddy = null;
|
|
61
68
|
let initPromise = null;
|
|
69
|
+
const Transform = await loadNodeTransform();
|
|
62
70
|
const transform = new Transform({
|
|
63
71
|
async transform(chunk, encoding, callback) {
|
|
64
72
|
try {
|
|
@@ -158,4 +166,4 @@ export {
|
|
|
158
166
|
convert,
|
|
159
167
|
convertToString
|
|
160
168
|
};
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
//# sourceMappingURL=chunk-27H3T556.js.map
|
package/dist/src/index.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ declare class ConvertBuddy {
|
|
|
44
44
|
finish(): Uint8Array;
|
|
45
45
|
stats(): Stats;
|
|
46
46
|
}
|
|
47
|
-
declare function createNodeTransform(opts?: ConvertBuddyOptions): Transform
|
|
47
|
+
declare function createNodeTransform(opts?: ConvertBuddyOptions): Promise<Transform>;
|
|
48
48
|
declare class ConvertBuddyTransformStream extends TransformStream<Uint8Array, Uint8Array> {
|
|
49
49
|
constructor(opts?: ConvertBuddyOptions);
|
|
50
50
|
}
|
package/dist/src/index.js
CHANGED
package/package.json
CHANGED
package/dist/chunk-VUNV25KB.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
-
}) : x)(function(x) {
|
|
5
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
__require,
|
|
14
|
-
__commonJS
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-VUNV25KB.js.map
|