inibase 1.0.0-rc.35 → 1.0.0-rc.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/file.js +3 -3
- package/package.json +1 -1
package/dist/file.js
CHANGED
|
@@ -314,7 +314,7 @@ export async function get(filePath, lineNumbers, fieldType, fieldChildrenType, s
|
|
|
314
314
|
*/
|
|
315
315
|
export const replace = async (filePath, replacements) => {
|
|
316
316
|
const fileTempPath = filePath.replace(/([^/]+)\/?$/, `.tmp/$1`);
|
|
317
|
-
if (await isExists(filePath)) {
|
|
317
|
+
if ((await isExists(filePath)) && (await stat(filePath)).size > 1) {
|
|
318
318
|
let fileHandle, fileTempHandle, rl;
|
|
319
319
|
try {
|
|
320
320
|
let linesCount = 0;
|
|
@@ -367,7 +367,7 @@ export const replace = async (filePath, replacements) => {
|
|
|
367
367
|
*/
|
|
368
368
|
export const append = async (filePath, data) => {
|
|
369
369
|
const fileTempPath = filePath.replace(/([^/]+)\/?$/, `.tmp/$1`);
|
|
370
|
-
if ((await isExists(filePath)) && (await stat(filePath)).size) {
|
|
370
|
+
if ((await isExists(filePath)) && (await stat(filePath)).size > 1) {
|
|
371
371
|
let fileHandle, fileTempHandle, rl;
|
|
372
372
|
try {
|
|
373
373
|
fileHandle = await open(filePath, "r");
|
|
@@ -636,7 +636,7 @@ export const search = async (filePath, operator, comparedAtValue, logicalOperato
|
|
|
636
636
|
export const count = async (filePath) => {
|
|
637
637
|
// return Number((await exec(`wc -l < ${filePath}`)).stdout.trim());
|
|
638
638
|
let linesCount = 0;
|
|
639
|
-
if (await isExists(filePath)) {
|
|
639
|
+
if ((await isExists(filePath)) && (await stat(filePath)).size > 1) {
|
|
640
640
|
let fileHandle, rl;
|
|
641
641
|
try {
|
|
642
642
|
(fileHandle = await open(filePath, "r")),
|