MCPcopy Create free account
hub / github.com/ShouChenICU/FastSend / getValFromLocalStorage

Function getValFromLocalStorage

app/utils/index.ts:203–215  ·  view source on GitHub ↗
(key: string, defVal?: T)

Source from the content-addressed store, hash-verified

201 * @returns
202 */
203export function getValFromLocalStorage<T>(key: string, defVal?: T): T | null {
204 const val = localStorage.getItem(key)
205 if (val) {
206 try {
207 return JSON.parse(val)
208 } catch (e) {}
209 }
210 if (defVal !== undefined) {
211 localStorage.setItem(key, JSON.stringify(defVal))
212 return defVal
213 }
214 return null
215}
216
217// 计算文件或Blob的MD5哈希值
218export async function calcMD5(file: File | Blob) {

Callers 1

initializeFromStorageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected