fix(core): update
This commit is contained in:
parent
b32c06aef2
commit
b391e54083
1
package-lock.json
generated
1
package-lock.json
generated
@ -10,6 +10,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^5.0.0",
|
"@pushrocks/lik": "^5.0.0",
|
||||||
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
||||||
"@pushrocks/smarthash": "^2.1.10",
|
"@pushrocks/smarthash": "^2.1.10",
|
||||||
"@pushrocks/smartjson": "^4.0.6",
|
"@pushrocks/smartjson": "^4.0.6",
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^5.0.0",
|
"@pushrocks/lik": "^5.0.0",
|
||||||
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
||||||
"@pushrocks/smarthash": "^2.1.10",
|
"@pushrocks/smarthash": "^2.1.10",
|
||||||
"@pushrocks/smartjson": "^4.0.6",
|
"@pushrocks/smartjson": "^4.0.6",
|
||||||
|
@ -377,11 +377,22 @@ export const listFileTree = async (
|
|||||||
/**
|
/**
|
||||||
* checks wether a file is ready for processing
|
* checks wether a file is ready for processing
|
||||||
*/
|
*/
|
||||||
export const waitForFileToBeReady = async (filePathArg: string) => {
|
export const waitForFileToBeReady = async (filePathArg: string): Promise<void> => {
|
||||||
const limitedArray = new plugins.lik.LimitedArray<string>(3);
|
|
||||||
if (!plugins.path.isAbsolute(filePathArg)) {
|
if (!plugins.path.isAbsolute(filePathArg)) {
|
||||||
filePathArg = plugins.path.resolve(filePathArg);
|
filePathArg = plugins.path.resolve(filePathArg);
|
||||||
};
|
|
||||||
const stats = await plugins.fsExtra.stat(filePathArg);
|
|
||||||
stats.size
|
|
||||||
}
|
}
|
||||||
|
const limitedArray = new plugins.lik.LimitedArray<number>(3);
|
||||||
|
let fileReady = false;
|
||||||
|
while (!fileReady) {
|
||||||
|
const stats = await plugins.fsExtra.stat(filePathArg);
|
||||||
|
limitedArray.addOne(stats.size);
|
||||||
|
if (
|
||||||
|
limitedArray.array.length < 3 ||
|
||||||
|
!(limitedArray.array[0] === limitedArray[1] && limitedArray.array[1] === limitedArray[2])
|
||||||
|
) {
|
||||||
|
await plugins.smartdelay.delayFor(5000);
|
||||||
|
} else {
|
||||||
|
fileReady = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -7,6 +7,7 @@ export { fs, path };
|
|||||||
// @pushrocks scope
|
// @pushrocks scope
|
||||||
import * as lik from '@pushrocks/lik';
|
import * as lik from '@pushrocks/lik';
|
||||||
import * as smartfileInterfaces from '@pushrocks/smartfile-interfaces';
|
import * as smartfileInterfaces from '@pushrocks/smartfile-interfaces';
|
||||||
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
import * as smarthash from '@pushrocks/smarthash';
|
import * as smarthash from '@pushrocks/smarthash';
|
||||||
import * as smartjson from '@pushrocks/smartjson';
|
import * as smartjson from '@pushrocks/smartjson';
|
||||||
import * as smartmime from '@pushrocks/smartmime';
|
import * as smartmime from '@pushrocks/smartmime';
|
||||||
@ -14,7 +15,7 @@ import * as smartpath from '@pushrocks/smartpath';
|
|||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
import * as smartrequest from '@pushrocks/smartrequest';
|
import * as smartrequest from '@pushrocks/smartrequest';
|
||||||
|
|
||||||
export { lik, smartfileInterfaces, smarthash, smartjson, smartmime, smartpath, smartpromise, smartrequest };
|
export { lik, smartfileInterfaces, smartdelay, smarthash, smartjson, smartmime, smartpath, smartpromise, smartrequest };
|
||||||
|
|
||||||
// third party scope
|
// third party scope
|
||||||
import * as fsExtra from 'fs-extra';
|
import * as fsExtra from 'fs-extra';
|
||||||
|
Loading…
Reference in New Issue
Block a user