index.d.ts 1.1 KB

1234567891011121314151617181920212223242526
  1. export declare function stringToBuffer(serializedString: string): ArrayBuffer;
  2. /**
  3. * Converts a buffer to a string to store, serialized, in the backend
  4. * storage library.
  5. */
  6. export declare function bufferToString(buffer: ArrayBufferLike): string;
  7. /**
  8. * Serialize a value, afterwards executing a callback (which usually
  9. * instructs the `setItem()` callback/promise to be executed). This is how
  10. * we store binary data with localStorage.
  11. * @param value
  12. * @param callback
  13. */
  14. export declare function serialize(this: any, value: any, callback: any): void;
  15. /**
  16. * Deserialize data we've inserted into a value column/field. We place
  17. * special markers into our strings to mark them as encoded; this isn't
  18. * as nice as a meta field, but it's the only sane thing we can do whilst
  19. * keeping localStorage support intact.
  20. *
  21. * Oftentimes this will just deserialize JSON content, but if we have a
  22. * special marker (SERIALIZED_MARKER, defined above), we will extract
  23. * some kind of arraybuffer/binary data/typed array out of the string.
  24. * @param value
  25. */
  26. export declare function deserialize(value: string): any;