fix(core): update
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartfile',
|
||||
version: '10.0.37',
|
||||
version: '10.0.38',
|
||||
description: 'offers smart ways to work with files in nodejs'
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import * as plugins from './smartfile.plugins.js';
|
||||
import * as fsStream from './fsstream.js';
|
||||
import * as smartfileFs from './fs.js';
|
||||
import * as smartfileFsStream from './fsstream.js';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
type StreamSource = () => Promise<Readable>;
|
||||
@ -21,7 +22,7 @@ export class StreamFile {
|
||||
// STATIC
|
||||
|
||||
public static async fromPath(filePath: string): Promise<StreamFile> {
|
||||
const streamSource = () => Promise.resolve(fsStream.createReadStream(filePath));
|
||||
const streamSource = () => Promise.resolve(smartfileFsStream.createReadStream(filePath));
|
||||
return new StreamFile(streamSource, filePath);
|
||||
}
|
||||
|
||||
@ -55,7 +56,7 @@ export class StreamFile {
|
||||
*/
|
||||
public async writeToDisk(filePathArg: string): Promise<void> {
|
||||
const readStream = await this.createReadStream();
|
||||
const writeStream = fsStream.createWriteStream(filePathArg);
|
||||
const writeStream = smartfileFsStream.createWriteStream(filePathArg);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
readStream.pipe(writeStream);
|
||||
@ -67,6 +68,7 @@ export class StreamFile {
|
||||
|
||||
public async writeToDir(dirPathArg: string) {
|
||||
const filePath = plugins.path.join(dirPathArg, this.relativeFilePath);
|
||||
await smartfileFs.ensureDir(plugins.path.parse(filePath).dir);
|
||||
return this.writeToDisk(filePath);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import * as interpreterMod from './interpreter.js';
|
||||
import * as memoryMod from './memory.js';
|
||||
|
||||
export * from './classes.smartfile.js';
|
||||
export * from './classes.streamfile.js';
|
||||
export * from './classes.virtualdirectory.js';
|
||||
|
||||
export const fs = fsMod;
|
||||
|
Reference in New Issue
Block a user