版博士V2.0程序
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

60 lignes
1.3 KiB

  1. /// <reference types="node" />
  2. import IBlob from './IBlob';
  3. /**
  4. * Reference:
  5. * https://developer.mozilla.org/en-US/docs/Web/API/Blob.
  6. *
  7. * Based on:
  8. * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/file-api/Blob-impl.js (MIT licensed).
  9. */
  10. export default class Blob implements IBlob {
  11. readonly _buffer: Buffer;
  12. readonly type: string;
  13. /**
  14. * Constructor.
  15. *
  16. * @param bits Bits.
  17. * @param [options] Options.
  18. * @param [options.type] MIME type.
  19. */
  20. constructor(bits: (ArrayBuffer | ArrayBufferView | Blob | Buffer | string)[], options?: {
  21. type?: string;
  22. });
  23. /**
  24. * Returns size.
  25. *
  26. * @returns Size.
  27. */
  28. get size(): number;
  29. /**
  30. * Slices the blob.
  31. *
  32. * @param start Start.
  33. * @param end End.
  34. * @param contentType Content type.
  35. * @returns New Blob.
  36. */
  37. slice(start?: number, end?: number, contentType?: string): Blob;
  38. /**
  39. * Returns a Promise that resolves to a ArrayBuffer.
  40. *
  41. * @returns ArrayBuffer.
  42. */
  43. /**
  44. *
  45. */
  46. arrayBuffer(): Promise<ArrayBuffer>;
  47. /**
  48. * Returns a Promise that resolves to a text.
  49. *
  50. * @returns Text.
  51. */
  52. text(): Promise<string>;
  53. /**
  54. * Closes the blob.
  55. *
  56. * @returns String.
  57. */
  58. toString(): string;
  59. }