fix(core): update

This commit is contained in:
2024-06-06 00:32:50 +02:00
parent eaaf313442
commit e48023d490
5 changed files with 220 additions and 4 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@apiclient.xyz/docker',
version: '1.1.3',
version: '1.1.4',
description: 'Provides easy communication with Docker remote API from Node.js, with TypeScript support.'
}

View File

@ -3,7 +3,14 @@ import * as paths from './paths.js';
import type { DockerHost } from './classes.host.js';
export interface IDockerImageStoreConstructorOptions {
dirPath: string;
/**
* used for preparing images for longer term storage
*/
localDirPath: string;
/**
* a smartbucket dir for longer term storage.
*/
bucketDir: plugins.smartbucket.Directory;
}
export class DockerImageStore {
@ -15,7 +22,7 @@ export class DockerImageStore {
// Method to store tar stream
public async storeImage(imageName: string, tarStream: plugins.smartstream.stream.Readable): Promise<void> {
const imagePath = plugins.path.join(this.options.dirPath, `${imageName}.tar`);
const imagePath = plugins.path.join(this.options.localDirPath, `${imageName}.tar`);
// Create a write stream to store the tar file
const writeStream = plugins.smartfile.fsStream.createWriteStream(imagePath);
@ -30,7 +37,7 @@ export class DockerImageStore {
// Method to retrieve tar stream
public async getImage(imageName: string): Promise<plugins.smartstream.stream.Readable> {
const imagePath = plugins.path.join(this.options.dirPath, `${imageName}.tar`);
const imagePath = plugins.path.join(this.options.localDirPath, `${imageName}.tar`);
if (!(await plugins.smartfile.fs.fileExists(imagePath))) {
throw new Error(`Image ${imageName} does not exist.`);

View File

@ -5,6 +5,7 @@ export { path };
// @pushrocks scope
import * as lik from '@push.rocks/lik';
import * as smartbucket from '@push.rocks/smartbucket';
import * as smartfile from '@push.rocks/smartfile';
import * as smartjson from '@push.rocks/smartjson';
import * as smartlog from '@push.rocks/smartlog';
@ -18,6 +19,7 @@ import * as smartversion from '@push.rocks/smartversion';
export {
lik,
smartbucket,
smartfile,
smartjson,
smartlog,