Remove rindle dependency

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-07-08 15:28:44 +01:00
parent 0da5f822e4
commit 11afbf3da2
3 changed files with 4 additions and 36 deletions

View File

@ -119,7 +119,6 @@ Examples:
const Bluebird = require('bluebird');
const unzip = require('node-unzip-2');
const fs = require('fs');
const rindle = require('rindle');
const manager = require('balena-image-manager');
console.info(`Getting device operating system for ${params.type}`);
@ -141,7 +140,7 @@ versions for the given device type are pre-release).`);
}
return manager.get(params.type, version);
})
.then(function (stream) {
.then(async function (stream) {
const visuals = getVisuals();
const bar = new visuals.Progress(
`Downloading Device OS${displayVersion}`,
@ -172,7 +171,9 @@ versions for the given device type are pre-release).`);
output = fs.createWriteStream(options.output);
}
return rindle.wait(stream.pipe(output)).return(options.output);
const streamToPromise = await import('stream-to-promise');
await streamToPromise(stream.pipe(output));
return options.output;
})
.tap(() => {
console.info('The image was downloaded successfully');

View File

@ -251,7 +251,6 @@
"resin-multibuild": "^4.5.1",
"resin-stream-logger": "^0.1.2",
"rimraf": "^3.0.2",
"rindle": "^1.3.6",
"semver": "^7.1.3",
"shell-escape": "^0.2.0",
"split": "^1.0.1",

View File

@ -1,32 +0,0 @@
/**
* @license
* Copyright 2019 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as Bluebird from 'bluebird';
declare module 'rindle' {
export function extract(
stream: NodeJS.ReadableStream,
callback: (error: Error, data: string) => void,
): void;
export function wait<T = any[]>(
stream: {
on(event: string, callback: (...args: T) => void): void;
},
callback?: (error: Error, data: string) => void,
): Bluebird<T>;
}