node-raspberrypi-usbboot
Advanced tools
Comparing version 0.2.8 to 0.2.9-remove-bluebird-fea90a0650f8bfe997c6bb1e6e163ce10bcb7bc7
@@ -10,3 +10,2 @@ "use strict"; | ||
const usb = require("@balena.io/usb"); | ||
const bluebird_1 = require("bluebird"); | ||
const _debug = require("debug"); | ||
@@ -16,3 +15,21 @@ const events_1 = require("events"); | ||
const Path = require("path"); | ||
const readFile = bluebird_1.promisify(fs_1.readFile); | ||
const util_1 = require("util"); | ||
async function delay(ms) { | ||
await new Promise((resolve) => { | ||
setTimeout(resolve, ms); | ||
}); | ||
} | ||
function fromCallback(fn) { | ||
return new Promise((resolve, reject) => { | ||
fn((error, result) => { | ||
if (error == null) { | ||
resolve(result); | ||
} | ||
else { | ||
reject(error); | ||
} | ||
}); | ||
}); | ||
} | ||
const readFile = util_1.promisify(fs_1.readFile); | ||
const debug = _debug('node-raspberrypi-usbboot'); | ||
@@ -141,3 +158,3 @@ const POLLING_INTERVAL_MS = 2000; | ||
device.timeout = USB_CONTROL_TRANSFER_TIMEOUT_MS; | ||
const result = await bluebird_1.fromCallback((callback) => { | ||
const result = await fromCallback((callback) => { | ||
device.controlTransfer(bmRequestType, bRequest, wValue, wIndex, dataOrLength, callback); | ||
@@ -200,3 +217,3 @@ }); | ||
try { | ||
await bluebird_1.fromCallback((callback) => { | ||
await fromCallback((callback) => { | ||
endpoint.transfer(chunk, callback); | ||
@@ -446,3 +463,3 @@ }); | ||
} | ||
await bluebird_1.delay(READ_ERROR_DELAY); | ||
await delay(READ_ERROR_DELAY); | ||
continue; | ||
@@ -475,3 +492,3 @@ } | ||
// If you try communicating with it, it will error, detach and reattach as expected. | ||
await bluebird_1.delay(2000); | ||
await delay(2000); | ||
try { | ||
@@ -478,0 +495,0 @@ device.open(); |
@@ -7,2 +7,7 @@ # Change Log | ||
# v0.2.9 | ||
## (2020-07-27) | ||
* Remove bluebird dependency [Alexis Svinartchouk] | ||
# v0.2.8 | ||
@@ -9,0 +14,0 @@ ## (2020-06-11) |
{ | ||
"name": "node-raspberrypi-usbboot", | ||
"version": "0.2.8", | ||
"version": "0.2.9-remove-bluebird-fea90a0650f8bfe997c6bb1e6e163ce10bcb7bc7", | ||
"description": "Transforms Raspberry Pi Compute Modules and Zeros to mass storage devices.", | ||
@@ -29,3 +29,2 @@ "main": "build/index.js", | ||
"@balena.io/usb": "^1.3.12", | ||
"bluebird": "^3.7.2", | ||
"debug": "^4.1.1" | ||
@@ -35,3 +34,2 @@ }, | ||
"@balena/lint": "^5.1.0", | ||
"@types/bluebird": "^3.5.32", | ||
"@types/debug": "^4.1.5", | ||
@@ -38,0 +36,0 @@ "@types/node": "^8.10.61", |
Sorry, the diff of this file is not supported yet
27828746
2
7
532
- Removedbluebird@^3.7.2
- Removedbluebird@3.7.2(transitive)