You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we don't have any definition file for this package. How about adding them?
I've made my own implementation and it works good enough to be used in global:
declare module 'megahash'{exportdefaultclassMegaHash<K,V>{/** * Set or replace one key/value in the hash. * Ideally both key and value are passed as Buffers, as this provides the highest performance. * Most built-in data types are supported of course, but they are converted to buffers one way or the other. * It actually returns a number that means type of result: 0 = error (out of memory), 1 = success, 2 = success (replaced existing value) * @param {V} key unique key * @param {K} value value to store */set(key: K,value:V): 0|1|2/** * Fetch a value given a key. * Since the value data type is stored internally as a flag with the raw data, this is used to convert the buffer back to the original type when the key is fetched. * So if you store a string then fetch it, it'll come back as a string. If there's no such value - it gonna reply back with undefined. * @param {K} key unique key */get(key: K): V/** * Tests given key. Returns true if there is a some value connected with this key and false otherwise. * @param {K} key unique key */has(key: K): boolean/** * Deletes key & connected to it value from hash. Returns true if it finds value and deletes it, false otherwise. * @param {K} key unique key */delete(key: K): boolean/** * Delete all keys from the hash, effectively freeing all memory (except for indexes). * You can also optionally pass in one or two 8-bit unsigned integers to this method, to clear an arbitrary "slice" of the total keys. This is an advanced trick, * only used for clearing out extremely large hashes in small chunks, as to not hang the main thread. * Pass in one number between 0 - 256 to clear a "thick slice" (approximately 1/256 of total keys). * @param {number} from * @param {number} to */clear(from?: number,to?: number): void/** * Returns a number of keys currently allocated in mega hash (map). */length(): number/** * Fetch statistics about the current hash, including the number of keys, total data size in memory, and more. The return value is a native Node.js object with several properties populated. */stats(): MegaHashStatistics}interfaceMegaHashStatistics{numKeys: numberdataSize: numberindexSize: numbermetaSize: numbernumIndexes: number}}
The text was updated successfully, but these errors were encountered:
Currently we don't have any definition file for this package. How about adding them?
I've made my own implementation and it works good enough to be used in global:
The text was updated successfully, but these errors were encountered: