Compare commits

..

2 Commits

Author SHA1 Message Date
02a0646a49 2.0.1 2021-04-19 12:12:49 +00:00
17eda1e56a fix(core): update 2021-04-19 12:12:48 +00:00
4 changed files with 30 additions and 4 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartarchive",
"version": "2.0.0",
"version": "2.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartarchive",
"version": "2.0.0",
"version": "2.0.1",
"description": "work with archives",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",

View File

@ -49,7 +49,8 @@ tap.test('should download a package from the registry', async () => {
);
});
tap.test('should extract a package using tarStream', async () => {
tap.test('should extract a package using tarStream', async (tools) => {
const done = tools.defer();
const testSmartarchive = new smartarchive.SmartArchive();
const testTgzBuffer = (
await testPlugins.smartfile.Smartfile.fromFilePath(
@ -61,8 +62,22 @@ tap.test('should extract a package using tarStream', async () => {
);
const subscription = extractionFileObservable.subscribe(file => {
console.log(file.path);
});
await tools.delayFor(2000);
done.resolve();
await done.promise;
});
tap.test('should extract a file from url to replaySubject', async (tools) => {
const done = tools.defer();
const testSmartarchive = new smartarchive.SmartArchive();
const extractionFileObservable = await testSmartarchive.extractArchiveFromUrlToObservable('https://verdaccio.lossless.one/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz');
const subscription = extractionFileObservable.subscribe(file => {
console.log(file.path);
});
await tools.delayFor(2000);
done.resolve();
await done.promise;
});
tap.start();

View File

@ -78,4 +78,15 @@ export class SmartArchive {
intake.signalEnd();
return replaySubject;
}
/**
* extracts to Observable
*/
public async extractArchiveFromUrlToObservable(
urlArg: string
): Promise<plugins.smartrx.rxjs.ReplaySubject<plugins.smartfile.Smartfile>> {
const response = await plugins.smartrequest.getBinary(urlArg);
const replaySubject = this.extractArchiveFromBufferToObservable(response.body);
return replaySubject;
}
}