Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

skynet-js

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skynet-js - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

5

CHANGELOG.md
# Changelog
## [2.1.1]
- Improve timeout handling for SkyDB
- Extend end-to-end tests
## [2.1.0]

@@ -4,0 +9,0 @@

7

dist/skydb.js

@@ -90,3 +90,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var customFilename, skylink, existing, result, error_1, value, signature, updated;
var customFilename, skylink, existing, error_1, value, signature, updated;
return __generator(this, function (_a) {

@@ -102,6 +102,5 @@ switch (_a.label) {

_a.trys.push([2, 4, , 5]);
return [4 /*yield*/, Promise.all([utils_1.timeout(2000), this.lookupRegistry(user, fileID)])];
return [4 /*yield*/, utils_1.promiseTimeout(this.lookupRegistry(user, fileID), 2000)];
case 3:
result = (_a.sent());
existing = result[1];
existing = _a.sent();
return [3 /*break*/, 5];

@@ -108,0 +107,0 @@ case 4:

@@ -18,5 +18,6 @@ export declare const defaultSkynetPortalUrl = "https://siasky.net";

export declare function randomNumber(low: number, high: number): number;
export declare function timeout(ms: number): Promise<unknown>;
export declare function promiseTimeout(promise: any, ms: number): Promise<any>;
export declare function stringToUint8Array(str: string): Uint8Array;
export declare function hexToUint8Array(str: string): Uint8Array;
export declare function readData(file: File): Promise<string | ArrayBuffer>;
//# sourceMappingURL=utils.d.ts.map

@@ -49,3 +49,3 @@ "use strict";

exports.__esModule = true;
exports.hexToUint8Array = exports.stringToUint8Array = exports.timeout = exports.randomNumber = exports.trimUriPrefix = exports.parseSkylink = exports.makeUrl = exports.getRootDirectory = exports.getRelativeFilePath = exports.defaultPortalUrl = exports.defaultOptions = exports.addUrlQuery = exports.uriSkynetPrefix = exports.uriHandshakeResolverPrefix = exports.uriHandshakePrefix = exports.defaultSkynetPortalUrl = void 0;
exports.readData = exports.hexToUint8Array = exports.stringToUint8Array = exports.promiseTimeout = exports.randomNumber = exports.trimUriPrefix = exports.parseSkylink = exports.makeUrl = exports.getRootDirectory = exports.getRelativeFilePath = exports.defaultPortalUrl = exports.defaultOptions = exports.addUrlQuery = exports.uriSkynetPrefix = exports.uriHandshakeResolverPrefix = exports.uriHandshakePrefix = exports.defaultSkynetPortalUrl = void 0;
var path_browserify_1 = __importDefault(require("path-browserify"));

@@ -151,14 +151,16 @@ var url_parse_1 = __importDefault(require("url-parse"));

exports.randomNumber = randomNumber;
function timeout(ms) {
function promiseTimeout(promise, ms) {
return __awaiter(this, void 0, void 0, function () {
var timeout;
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
setTimeout(function () {
resolve(null);
}, ms);
})];
timeout = new Promise(function (resolve, reject) {
setTimeout(function () {
reject("Timed out after " + ms + "ms");
}, ms);
});
return [2 /*return*/, Promise.race([promise, timeout])];
});
});
}
exports.timeout = timeout;
exports.promiseTimeout = promiseTimeout;
// stringToUint8Array converts a string to a uint8 array

@@ -174,1 +176,12 @@ function stringToUint8Array(str) {

exports.hexToUint8Array = hexToUint8Array;
// readData is a helper function that uses a FileReader to read the contents of
// the given file
function readData(file) {
return new Promise(function (resolve, reject) {
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function () { return resolve(reader.result); };
reader.onerror = function (error) { return reject(error); };
});
}
exports.readData = readData;
{
"name": "skynet-js",
"version": "2.1.0",
"version": "2.1.1",
"description": "Sia Skynet Javascript Client",

@@ -17,2 +17,3 @@ "main": "dist/index.js",

"jest": {
"testTimeout": 60000,
"clearMocks": true,

@@ -19,0 +20,0 @@ "rootDir": "src"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc