Compare commits

...

6 Commits

Author SHA1 Message Date
36c456b509 10.0.32 2023-09-22 17:05:35 +02:00
16f8c25557 fix(core): update 2023-09-22 17:05:35 +02:00
219e070ba2 10.0.31 2023-08-31 18:45:24 +02:00
ee97e1d88b fix(core): update 2023-08-31 18:45:23 +02:00
279db74568 10.0.30 2023-08-23 10:58:38 +02:00
b84c504f11 fix(core): update 2023-08-23 10:58:38 +02:00
6 changed files with 1822 additions and 955 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "@push.rocks/smartfile", "name": "@push.rocks/smartfile",
"private": false, "private": false,
"version": "10.0.29", "version": "10.0.32",
"description": "offers smart ways to work with files in nodejs", "description": "offers smart ways to work with files in nodejs",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
@ -26,29 +26,29 @@
}, },
"homepage": "https://gitlab.com/pushrocks/smartfile", "homepage": "https://gitlab.com/pushrocks/smartfile",
"dependencies": { "dependencies": {
"@push.rocks/lik": "^6.0.2", "@push.rocks/lik": "^6.0.5",
"@push.rocks/smartdelay": "^3.0.1", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile-interfaces": "^1.0.7", "@push.rocks/smartfile-interfaces": "^1.0.7",
"@push.rocks/smarthash": "^3.0.2", "@push.rocks/smarthash": "^3.0.4",
"@push.rocks/smartjson": "^5.0.6", "@push.rocks/smartjson": "^5.0.10",
"@push.rocks/smartmime": "^1.0.5", "@push.rocks/smartmime": "^1.0.5",
"@push.rocks/smartpath": "^5.0.5", "@push.rocks/smartpath": "^5.0.11",
"@push.rocks/smartpromise": "^4.0.2", "@push.rocks/smartpromise": "^4.0.2",
"@push.rocks/smartrequest": "^2.0.15", "@push.rocks/smartrequest": "^2.0.18",
"@push.rocks/smartstream": "^2.0.3", "@push.rocks/smartstream": "^2.0.4",
"@types/fs-extra": "^11.0.1", "@types/fs-extra": "^11.0.2",
"@types/glob": "^8.1.0", "@types/glob": "^8.1.0",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.6",
"fs-extra": "^11.1.1", "fs-extra": "^11.1.1",
"glob": "^10.3.3", "glob": "^10.3.5",
"js-yaml": "^4.1.0" "js-yaml": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.66", "@git.zone/tsbuild": "^2.1.70",
"@gitzone/tsrun": "^1.2.42", "@git.zone/tsrun": "^1.2.46",
"@gitzone/tstest": "^1.0.74", "@git.zone/tstest": "^1.0.81",
"@pushrocks/tapbundle": "^5.0.8", "@push.rocks/tapbundle": "^5.0.15",
"@types/node": "^20.4.1" "@types/node": "^20.6.3"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

2722
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
import * as smartfile from '../ts/index.js'; import * as smartfile from '../ts/index.js';
import * as path from 'path'; import * as path from 'path';
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@push.rocks/tapbundle';
// --------------------------- // ---------------------------
// smartfile.fs // smartfile.fs

View File

@ -1,4 +1,4 @@
import { tap, expect } from '@pushrocks/tapbundle'; import { tap, expect } from '@push.rocks/tapbundle';
import * as smartfile from '../ts/index.js'; import * as smartfile from '../ts/index.js';

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartfile', name: '@push.rocks/smartfile',
version: '10.0.29', version: '10.0.32',
description: 'offers smart ways to work with files in nodejs' description: 'offers smart ways to work with files in nodejs'
} }

View File

@ -40,7 +40,18 @@ export const fileExists = async (filePath): Promise<boolean> => {
/** /**
* Checks if given path points to an existing directory * Checks if given path points to an existing directory
*/ */
export const isDirectory = (pathArg): boolean => { export const isDirectory = (pathArg: string): boolean => {
try {
return plugins.fsExtra.statSync(pathArg).isDirectory();
} catch (err) {
return false;
}
};
/**
* Checks if given path points to an existing directory
*/
export const isDirectorySync = (pathArg: string): boolean => {
try { try {
return plugins.fsExtra.statSync(pathArg).isDirectory(); return plugins.fsExtra.statSync(pathArg).isDirectory();
} catch (err) { } catch (err) {
@ -244,12 +255,12 @@ export const fileTreeToObject = async (dirPathArg: string, miniMatchFilter: stri
return filePath; return filePath;
} }
})(); })();
const fileContentString = toStringSync(readPath); const fileBuffer = plugins.fs.readFileSync(readPath);
// push a read file as Smartfile // push a read file as Smartfile
smartfileArray.push( smartfileArray.push(
new Smartfile({ new Smartfile({
contentBuffer: Buffer.from(fileContentString), contentBuffer: fileBuffer,
base: dirPath, base: dirPath,
path: filePath, path: filePath,
}) })