zkcloudworker 0.8.2 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/cloud/config.d.ts +1 -0
- package/lib/ts/src/cloud/config.js +1 -0
- package/lib/{web/src/cloud/utils/hash.d.ts → ts/src/cloud/utils/base64.d.ts} +0 -1
- package/lib/ts/src/cloud/utils/{hash.js → base64.js} +1 -11
- package/lib/ts/src/cloud/utils/index.d.ts +1 -2
- package/lib/ts/src/cloud/utils/index.js +1 -2
- package/lib/ts/src/cloud/worker/job.d.ts +26 -26
- package/lib/ts/src/mina/api/api.js +4 -1
- package/lib/ts/src/mina/local/local.d.ts +4 -1
- package/lib/ts/src/mina/local/local.js +44 -28
- package/lib/ts/src/mina/utils/base64.js +5 -5
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/cloud/config.d.ts +1 -0
- package/lib/web/src/cloud/config.js +1 -0
- package/lib/web/src/cloud/config.js.map +1 -1
- package/lib/{ts/src/cloud/utils/hash.d.ts → web/src/cloud/utils/base64.d.ts} +0 -1
- package/lib/web/src/cloud/utils/{hash.js → base64.js} +1 -7
- package/lib/web/src/cloud/utils/base64.js.map +1 -0
- package/lib/web/src/cloud/utils/index.d.ts +1 -2
- package/lib/web/src/cloud/utils/index.js +1 -2
- package/lib/web/src/cloud/utils/index.js.map +1 -1
- package/lib/web/src/cloud/worker/job.d.ts +26 -26
- package/lib/web/src/mina/api/api.js +4 -1
- package/lib/web/src/mina/api/api.js.map +1 -1
- package/lib/web/src/mina/local/local.d.ts +4 -1
- package/lib/web/src/mina/local/local.js +43 -27
- package/lib/web/src/mina/local/local.js.map +1 -1
- package/lib/web/src/mina/utils/base64.js +1 -1
- package/lib/web/src/mina/utils/base64.js.map +1 -1
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/lib/ts/src/cloud/utils/files.d.ts +0 -11
- package/lib/ts/src/cloud/utils/files.js +0 -74
- package/lib/web/src/cloud/utils/files.d.ts +0 -11
- package/lib/web/src/cloud/utils/files.js +0 -65
- package/lib/web/src/cloud/utils/files.js.map +0 -1
- package/lib/web/src/cloud/utils/hash.js.map +0 -1
@@ -1,74 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.loadBinaryFile = exports.saveBinaryFile = exports.loadFile = exports.saveFile = void 0;
|
7
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
8
|
-
async function saveFile(params) {
|
9
|
-
const { data, filename } = params;
|
10
|
-
const folder = "./data/";
|
11
|
-
const name = folder + filename + ".json";
|
12
|
-
try {
|
13
|
-
await promises_1.default.access("./data");
|
14
|
-
}
|
15
|
-
catch (e) {
|
16
|
-
// if not, create it
|
17
|
-
await promises_1.default.mkdir("./data");
|
18
|
-
}
|
19
|
-
try {
|
20
|
-
await promises_1.default.writeFile(name, JSON.stringify(data, null, 2));
|
21
|
-
return name;
|
22
|
-
}
|
23
|
-
catch (e) {
|
24
|
-
console.error(`Error writing file ${name}`);
|
25
|
-
return undefined;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
exports.saveFile = saveFile;
|
29
|
-
async function loadFile(filename) {
|
30
|
-
const name = "./data/" + filename + ".json";
|
31
|
-
try {
|
32
|
-
const filedata = await promises_1.default.readFile(name, "utf8");
|
33
|
-
const data = JSON.parse(filedata);
|
34
|
-
return data;
|
35
|
-
}
|
36
|
-
catch (e) {
|
37
|
-
console.error(`File ${name} does not exist or has wrong format`);
|
38
|
-
return undefined;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
exports.loadFile = loadFile;
|
42
|
-
async function saveBinaryFile(params) {
|
43
|
-
const { data, filename } = params;
|
44
|
-
const folder = "./data/";
|
45
|
-
const name = folder + filename + ".bin";
|
46
|
-
try {
|
47
|
-
await promises_1.default.access("./data");
|
48
|
-
}
|
49
|
-
catch (e) {
|
50
|
-
// if not, create it
|
51
|
-
await promises_1.default.mkdir("./data");
|
52
|
-
}
|
53
|
-
try {
|
54
|
-
await promises_1.default.writeFile(name, data);
|
55
|
-
return name;
|
56
|
-
}
|
57
|
-
catch (e) {
|
58
|
-
console.error(`Error writing file ${name}`);
|
59
|
-
return undefined;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
exports.saveBinaryFile = saveBinaryFile;
|
63
|
-
async function loadBinaryFile(filename) {
|
64
|
-
const name = "./data/" + filename + ".bin";
|
65
|
-
try {
|
66
|
-
const data = await promises_1.default.readFile(name);
|
67
|
-
return data;
|
68
|
-
}
|
69
|
-
catch (e) {
|
70
|
-
console.error(`File ${name} does not exist or has wrong format`);
|
71
|
-
return undefined;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
exports.loadBinaryFile = loadBinaryFile;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
export declare function saveFile(params: {
|
3
|
-
data: any;
|
4
|
-
filename: string;
|
5
|
-
}): Promise<string | undefined>;
|
6
|
-
export declare function loadFile(filename: string): Promise<any>;
|
7
|
-
export declare function saveBinaryFile(params: {
|
8
|
-
data: any;
|
9
|
-
filename: string;
|
10
|
-
}): Promise<string | undefined>;
|
11
|
-
export declare function loadBinaryFile(filename: string): Promise<Buffer | undefined>;
|
@@ -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
|
-
}
|
65
|
-
//# sourceMappingURL=files.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../../../../../src/cloud/utils/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAI9B;IACC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAClC,MAAM,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,IAAI,GAAG,MA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