fix(core): update
This commit is contained in:
parent
629c52f9bc
commit
6fee0028d8
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartfile',
|
name: '@push.rocks/smartfile',
|
||||||
version: '10.0.33',
|
version: '10.0.34',
|
||||||
description: 'offers smart ways to work with files in nodejs'
|
description: 'offers smart ways to work with files in nodejs'
|
||||||
}
|
}
|
||||||
|
@ -221,6 +221,18 @@ export const toBufferSync = (filePath: string): Buffer => {
|
|||||||
return plugins.fsExtra.readFileSync(filePath);
|
return plugins.fsExtra.readFileSync(filePath);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Readable Stream from a file path.
|
||||||
|
* @param filePath The path to the file.
|
||||||
|
* @returns {fs.ReadStream}
|
||||||
|
*/
|
||||||
|
export const toReadStream = (filePath: string): plugins.fs.ReadStream => {
|
||||||
|
if (!fileExistsSync(filePath)) {
|
||||||
|
throw new Error(`File does not exist at path: ${filePath}`);
|
||||||
|
}
|
||||||
|
return plugins.fsExtra.createReadStream(filePath);
|
||||||
|
};
|
||||||
|
|
||||||
export const fileTreeToHash = async (dirPathArg: string, miniMatchFilter: string) => {
|
export const fileTreeToHash = async (dirPathArg: string, miniMatchFilter: string) => {
|
||||||
const fileTreeObject = await fileTreeToObject(dirPathArg, miniMatchFilter);
|
const fileTreeObject = await fileTreeToObject(dirPathArg, miniMatchFilter);
|
||||||
let combinedString = '';
|
let combinedString = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user