-
-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Labels
Status: PR WelcomeWelcome to Pull RequestWelcome to Pull RequestStatus: ProposalRequest for commentsRequest for comments
Description
I have received this here on a project I have been working on:
QUOTA_EXCEEDED_ERR: Unknown error.
at LocalStorage.setItem (/node_modules/node-localstorage/LocalStorage.js:215:15)
at setItem (/node_modules/@kvs/storage/src/storage.ts:34:20)
at <anonymous> (/node_modules/@kvs/storage/src/storage.ts:156:35)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at run (/some-file.ts:97:17)
It would be good if we could pass something or the same default as a second argument here
| storage: new LocalStorage(saveFilePath) |
Looking at the node-localstorage implementation here:
5 * 1024 * 1024 is the default value
I did just change the value up to 25 * 1024 * 1024 right in the dependency code for now, but I should probably do a PR for it instead.
Say something like...
export type KvsLocalStorageOptions<Schema extends KvsLocalStorageSchema> = KVSOptions<Schema> & {
kvsVersionKey?: string;
storeFilePath?: string;
storeQuota?: number;
};
export const kvsLocalStorage = async <Schema extends KvsLocalStorageSchema>(
options: KvsLocalStorageOptions<Schema>
): Promise<KvsStorage<Schema>> => {
const defaultCacheDir = path.join(appRoot.toString(), ".cache");
if (!options.storeFilePath) {
await mkdirp(defaultCacheDir);
}
const saveFilePath = options.storeFilePath
? options.storeFilePath
: path.join(defaultCacheDir, "kvs-node-localstorage");
const storeQuota = options.storeQuota
? options.storeQuota
: 5 * 1024 * 1024
return kvsStorage({
...options,
storage: new LocalStorage(saveFilePath, storeQuota)
});
};How does this then work with @kvs/env ?
Metadata
Metadata
Assignees
Labels
Status: PR WelcomeWelcome to Pull RequestWelcome to Pull RequestStatus: ProposalRequest for commentsRequest for comments