existsSync() not working?
Is this library still maintained?
if I test to see if a directory exists in a previously created IndexedDB filesystem instance with existsSync(), I always get false.
Then an error when I try to create the directory ...
My code:
(new Promise((resolve, reject) => {
if (!fs.existsSync(stagingRoot+path.getValue())) {
fs.mkdir(stagingRoot+path.getValue(), {recursive:true}, (err) => {
if (err) console.log('error! = ',err)
if (err) reject(err)
resolve(true)
})
}
}))
The error:
edit:1 Uncaught (in promise)
ApiError {syscall: "", errno: 17, code: "EEXIST", path: "/staging", stack: "Error↵ at new ApiError (https://unpkg.com/brows…r.onsuccess (https://unpkg.com/browserfs:9504:18)", …}
code: "EEXIST"
errno: 17
message: "Error: EEXIST: File exists., '/staging'"
path: "/staging"
stack: "Error↵ at new ApiError (https://unpkg.com/browserfs:127:23)↵ at Function.FileError (https://unpkg.com/browserfs:152:17)↵ at Function.EEXIST (https://unpkg.com/browserfs:158:22)↵ at https://unpkg.com/browserfs:9299:38↵ at IndexedDBRWTransaction.abort (https://unpkg.com/browserfs:9572:14)↵ at https://unpkg.com/browserfs:9298:25↵ at https://unpkg.com/browserfs:9238:26↵ at https://unpkg.com/browserfs:9215:26↵ at IDBRequest.r.onsuccess (https://unpkg.com/browserfs:9504:18)"
syscall: ""
__proto__: Error
IndexedDB does not support "sync"
@loic-meister-guild
Is this library still maintained?
Yes
if I test to see if a directory exists in a previously created IndexedDB filesystem instance with existsSync(), I always get false.
Please try with the latest dev version, it should work.
@loic-meister-guild If you want to use sync functions with IndexedDB you need to use AsyncMirror. That should fix the issues you are having (you can then use the sync versions of mkdir).