ethers.js/packages/testcases/lib.esm/index.js

20 lines
883 B
JavaScript
Raw Permalink Normal View History

'use strict';
import fs from 'fs';
import path from 'path';
import zlib from 'browserify-zlib';
import { randomBytes, randomHexString, randomNumber } from "./random";
export { randomBytes, randomHexString, randomNumber };
export function saveTests(tag, data) {
//let filename = path.resolve(__dirname, 'testcases', tag + '.json.gz');
2020-01-06 19:00:55 -05:00
let filename = path.resolve(__dirname, '../testcases', tag + '.json.gz');
fs.writeFileSync(filename, zlib.gzipSync(JSON.stringify(data, undefined, ' ') + '\n'));
console.log('Save testcase: ' + filename);
}
export function loadTests(tag) {
let filename = path.resolve(__dirname, '../testcases', tag + '.json.gz');
return JSON.parse(zlib.gunzipSync(fs.readFileSync(filename)).toString());
}
export function loadData(filename) {
return fs.readFileSync(path.resolve(__dirname, filename));
}
2020-07-13 08:03:56 -04:00
//# sourceMappingURL=index.js.map