zkcloudworker 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/cloud/worker/cloud.d.ts +0 -6
- package/lib/ts/src/mina/local/local.d.ts +3 -5
- package/lib/ts/src/mina/local/local.js +7 -11
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/cloud/worker/cloud.d.ts +0 -6
- package/lib/web/src/cloud/worker/cloud.js.map +1 -1
- package/lib/{ts/src/index-node.d.ts → web/src/index.js} +1 -1
- package/lib/web/src/index.js.map +1 -0
- package/lib/web/src/mina/local/local.d.ts +3 -5
- package/lib/web/src/mina/local/local.js +7 -11
- package/lib/web/src/mina/local/local.js.map +1 -1
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/lib/ts/src/index-node.js +0 -19
- package/lib/ts/src/node/files.d.ts +0 -11
- package/lib/ts/src/node/files.js +0 -74
- package/lib/ts/src/node/hash.d.ts +0 -1
- package/lib/ts/src/node/hash.js +0 -14
- package/lib/ts/src/node/index.d.ts +0 -2
- package/lib/ts/src/node/index.js +0 -18
- package/lib/web/src/index-node.d.ts +0 -3
- package/lib/web/src/index-node.js +0 -4
- package/lib/web/src/index-node.js.map +0 -1
- package/lib/web/src/index-web.js +0 -3
- package/lib/web/src/index-web.js.map +0 -1
- package/lib/web/src/node/files.d.ts +0 -11
- package/lib/web/src/node/files.js +0 -65
- package/lib/web/src/node/files.js.map +0 -1
- package/lib/web/src/node/hash.d.ts +0 -1
- package/lib/web/src/node/hash.js +0 -8
- package/lib/web/src/node/hash.js.map +0 -1
- package/lib/web/src/node/index.d.ts +0 -2
- package/lib/web/src/node/index.js +0 -3
- package/lib/web/src/node/index.js.map +0 -1
- /package/lib/ts/src/{index-web.d.ts → index.d.ts} +0 -0
- /package/lib/ts/src/{index-web.js → index.js} +0 -0
- /package/lib/web/src/{index-web.d.ts → index.d.ts} +0 -0
@@ -1,65 +0,0 @@
|
|
1
|
-
import fs from "fs/promises";
|
2
|
-
export async function saveFile(params) {
|
3
|
-
const { data, filename } = params;
|
4
|
-
const folder = "./data/";
|
5
|
-
const name = folder + filename + ".json";
|
6
|
-
try {
|
7
|
-
await fs.access("./data");
|
8
|
-
}
|
9
|
-
catch (e) {
|
10
|
-
// if not, create it
|
11
|
-
await fs.mkdir("./data");
|
12
|
-
}
|
13
|
-
try {
|
14
|
-
await fs.writeFile(name, JSON.stringify(data, null, 2));
|
15
|
-
return name;
|
16
|
-
}
|
17
|
-
catch (e) {
|
18
|
-
console.error(`Error writing file ${name}`);
|
19
|
-
return undefined;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
export async function loadFile(filename) {
|
23
|
-
const name = "./data/" + filename + ".json";
|
24
|
-
try {
|
25
|
-
const filedata = await fs.readFile(name, "utf8");
|
26
|
-
const data = JSON.parse(filedata);
|
27
|
-
return data;
|
28
|
-
}
|
29
|
-
catch (e) {
|
30
|
-
console.error(`File ${name} does not exist or has wrong format`);
|
31
|
-
return undefined;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
export async function saveBinaryFile(params) {
|
35
|
-
const { data, filename } = params;
|
36
|
-
const folder = "./data/";
|
37
|
-
const name = folder + filename + ".bin";
|
38
|
-
try {
|
39
|
-
await fs.access("./data");
|
40
|
-
}
|
41
|
-
catch (e) {
|
42
|
-
// if not, create it
|
43
|
-
await fs.mkdir("./data");
|
44
|
-
}
|
45
|
-
try {
|
46
|
-
await fs.writeFile(name, data);
|
47
|
-
return name;
|
48
|
-
}
|
49
|
-
catch (e) {
|
50
|
-
console.error(`Error writing file ${name}`);
|
51
|
-
return undefined;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
export async function loadBinaryFile(filename) {
|
55
|
-
const name = "./data/" + filename + ".bin";
|
56
|
-
try {
|
57
|
-
const data = await fs.readFile(name);
|
58
|
-
return data;
|
59
|
-
}
|
60
|
-
catch (e) {
|
61
|
-
console.error(`File ${name} does not exist or has wrong format`);
|
62
|
-
return undefined;
|
63
|
-
}
|
64
|
-
}
|
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+0,0 @@
|
|
1
|
-
import crypto from "crypto";
|
2
|
-
import { bigintToBase56 } from "../cloud/";
|
3
|
-
export function stringHash(jsonString) {
|
4
|
-
if (typeof jsonString !== "string")
|
5
|
-
throw new Error("stringHash: input must be a string");
|
6
|
-
return bigintToBase56(BigInt("0x" + crypto.createHash("sha256").update(jsonString).digest("hex")));
|
7
|
-
}
|
8
|
-
//# sourceMappingURL=hash.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../../../src/node/hash.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,UAAU,UAAU,CAAC,UAAkB;IAC3C,IAAI,OAAO,UAAU,KAAK,QAAQ;QAChC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,OAAO,cAAc,CACnB,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC5E,CAAC;AACJ,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
File without changes
|
File without changes
|
File without changes
|