Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 5 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. declare module "safe-buffer" {
  2. export class Buffer {
  3. length: number
  4. write(string: string, offset?: number, length?: number, encoding?: string): number;
  5. toString(encoding?: string, start?: number, end?: number): string;
  6. toJSON(): { type: 'Buffer', data: any[] };
  7. equals(otherBuffer: Buffer): boolean;
  8. compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
  9. copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
  10. slice(start?: number, end?: number): Buffer;
  11. writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
  12. writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
  13. writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
  14. writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
  15. readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
  16. readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
  17. readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
  18. readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
  19. readUInt8(offset: number, noAssert?: boolean): number;
  20. readUInt16LE(offset: number, noAssert?: boolean): number;
  21. readUInt16BE(offset: number, noAssert?: boolean): number;
  22. readUInt32LE(offset: number, noAssert?: boolean): number;
  23. readUInt32BE(offset: number, noAssert?: boolean): number;
  24. readInt8(offset: number, noAssert?: boolean): number;
  25. readInt16LE(offset: number, noAssert?: boolean): number;
  26. readInt16BE(offset: number, noAssert?: boolean): number;
  27. readInt32LE(offset: number, noAssert?: boolean): number;
  28. readInt32BE(offset: number, noAssert?: boolean): number;
  29. readFloatLE(offset: number, noAssert?: boolean): number;
  30. readFloatBE(offset: number, noAssert?: boolean): number;
  31. readDoubleLE(offset: number, noAssert?: boolean): number;
  32. readDoubleBE(offset: number, noAssert?: boolean): number;
  33. swap16(): Buffer;
  34. swap32(): Buffer;
  35. swap64(): Buffer;
  36. writeUInt8(value: number, offset: number, noAssert?: boolean): number;
  37. writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
  38. writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
  39. writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
  40. writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
  41. writeInt8(value: number, offset: number, noAssert?: boolean): number;
  42. writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
  43. writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
  44. writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
  45. writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
  46. writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
  47. writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
  48. writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
  49. writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
  50. fill(value: any, offset?: number, end?: number): this;
  51. indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
  52. lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
  53. includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
  54. /**
  55. * Allocates a new buffer containing the given {str}.
  56. *
  57. * @param str String to store in buffer.
  58. * @param encoding encoding to use, optional. Default is 'utf8'
  59. */
  60. constructor (str: string, encoding?: string);
  61. /**
  62. * Allocates a new buffer of {size} octets.
  63. *
  64. * @param size count of octets to allocate.
  65. */
  66. constructor (size: number);
  67. /**
  68. * Allocates a new buffer containing the given {array} of octets.
  69. *
  70. * @param array The octets to store.
  71. */
  72. constructor (array: Uint8Array);
  73. /**
  74. * Produces a Buffer backed by the same allocated memory as
  75. * the given {ArrayBuffer}.
  76. *
  77. *
  78. * @param arrayBuffer The ArrayBuffer with which to share memory.
  79. */
  80. constructor (arrayBuffer: ArrayBuffer);
  81. /**
  82. * Allocates a new buffer containing the given {array} of octets.
  83. *
  84. * @param array The octets to store.
  85. */
  86. constructor (array: any[]);
  87. /**
  88. * Copies the passed {buffer} data onto a new {Buffer} instance.
  89. *
  90. * @param buffer The buffer to copy.
  91. */
  92. constructor (buffer: Buffer);
  93. prototype: Buffer;
  94. /**
  95. * Allocates a new Buffer using an {array} of octets.
  96. *
  97. * @param array
  98. */
  99. static from(array: any[]): Buffer;
  100. /**
  101. * When passed a reference to the .buffer property of a TypedArray instance,
  102. * the newly created Buffer will share the same allocated memory as the TypedArray.
  103. * The optional {byteOffset} and {length} arguments specify a memory range
  104. * within the {arrayBuffer} that will be shared by the Buffer.
  105. *
  106. * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
  107. * @param byteOffset
  108. * @param length
  109. */
  110. static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
  111. /**
  112. * Copies the passed {buffer} data onto a new Buffer instance.
  113. *
  114. * @param buffer
  115. */
  116. static from(buffer: Buffer): Buffer;
  117. /**
  118. * Creates a new Buffer containing the given JavaScript string {str}.
  119. * If provided, the {encoding} parameter identifies the character encoding.
  120. * If not provided, {encoding} defaults to 'utf8'.
  121. *
  122. * @param str
  123. */
  124. static from(str: string, encoding?: string): Buffer;
  125. /**
  126. * Returns true if {obj} is a Buffer
  127. *
  128. * @param obj object to test.
  129. */
  130. static isBuffer(obj: any): obj is Buffer;
  131. /**
  132. * Returns true if {encoding} is a valid encoding argument.
  133. * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
  134. *
  135. * @param encoding string to test.
  136. */
  137. static isEncoding(encoding: string): boolean;
  138. /**
  139. * Gives the actual byte length of a string. encoding defaults to 'utf8'.
  140. * This is not the same as String.prototype.length since that returns the number of characters in a string.
  141. *
  142. * @param string string to test.
  143. * @param encoding encoding used to evaluate (defaults to 'utf8')
  144. */
  145. static byteLength(string: string, encoding?: string): number;
  146. /**
  147. * Returns a buffer which is the result of concatenating all the buffers in the list together.
  148. *
  149. * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
  150. * If the list has exactly one item, then the first item of the list is returned.
  151. * If the list has more than one item, then a new Buffer is created.
  152. *
  153. * @param list An array of Buffer objects to concatenate
  154. * @param totalLength Total length of the buffers when concatenated.
  155. * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
  156. */
  157. static concat(list: Buffer[], totalLength?: number): Buffer;
  158. /**
  159. * The same as buf1.compare(buf2).
  160. */
  161. static compare(buf1: Buffer, buf2: Buffer): number;
  162. /**
  163. * Allocates a new buffer of {size} octets.
  164. *
  165. * @param size count of octets to allocate.
  166. * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
  167. * If parameter is omitted, buffer will be filled with zeros.
  168. * @param encoding encoding used for call to buf.fill while initalizing
  169. */
  170. static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
  171. /**
  172. * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
  173. * of the newly created Buffer are unknown and may contain sensitive data.
  174. *
  175. * @param size count of octets to allocate
  176. */
  177. static allocUnsafe(size: number): Buffer;
  178. /**
  179. * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
  180. * of the newly created Buffer are unknown and may contain sensitive data.
  181. *
  182. * @param size count of octets to allocate
  183. */
  184. static allocUnsafeSlow(size: number): Buffer;
  185. }
  186. }