Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What to search for.
- Where to begin searching in
- If is a string, this is its encoding.
- Returns: if was found in, otherwise.
- Equivalent to
- Prints
- 97 is the decimal ASCII value for
- If is a string, this is the encoding used to determine the binary representation of the string that will be searched for in
- The index of the first occurrence of in, or if does not contain
- If is:
- a string, is interpreted according to the character encoding in
- a or, will be used in its entirety.
- To compare a partial, use
- a number, will be interpreted as an unsigned 8-bit integer value between and
- If is not a string, number, or, this method will throw a
- If is a number, it will be coerced to a valid byte value, an integer between 0 and 255.
- If is not a number, it will be coerced to a number.
- If the result of coercion is or, then the entire buffer will be searched.
- This behavior matches
- Passing a value that's a number, but not a valid byte
- equivalent to searching for 99 or
- Passing a that coerces to or
- searching the whole buffer
- If is an empty string or empty and is less than, will be returned.
- If is empty and is at least, will be returned.
- Creates and returns an of keys (indices).
- Identical to, except the last occurrence of is found rather than the first occurrence.
- Any arguments that coerce to, like or, will search the whole buffer.
- If is an empty string or empty, will be returned.
- Returns the amount of memory allocated for in bytes.
- Note that this does not necessarily reflect the amount of "usable" data within
- // Create a and write a shorter ASCII string to it.
- While the property is not immutable, changing the value of can result in undefined and inconsistent behavior.
- Applications that wish to modify the length of a should therefore treat as read-only and use to create a new
- Stability: 0 - Deprecated: Use instead.
- The property is a deprecated alias for
- Number of bytes to skip before starting to read.
- Must satisfy
- Reads a 64-bit double from at the specified with specified endian format (returns big endian, returns little endian).
- Reads a 32-bit float from at the specified with specified endian format (returns big endian, returns little endian).
- Reads a signed 8-bit integer from at the specified
- Integers read from a are interpreted as two's complement signed values.
- Reads a signed 16-bit integer from at the specified with the specified endian format (returns big endian, returns little endian).
- Reads number of bytes from at the specified and interprets the result as a two's complement signed value.
- Supports up to 48 bits of accuracy.
- Reads an unsigned 8-bit integer from at the specified
- Reads number of bytes from at the specified and interprets the result as an unsigned integer.
- Where the new will start.
- Where the new will end (not inclusive).
- Returns a new that references the same memory as the original, but offset and cropped by the and indices.
- Specifying greater than will return the same result as that of equal to
- Modifying the new slice will modify the memory in the original because the allocated memory of the two objects overlap.
- // Create a with the ASCII alphabet, take a slice, and modify one byte from the original
- Specifying negative indexes causes the slice to be generated relative to the end of rather than the beginning.
- Interprets as an array of unsigned 16-bit integers and swaps the byte order in-place
- Throws if is not a multiple of 2.
- Interprets as an array of 64-bit numbers and swaps byte order in-place
- Note that JavaScript cannot encode 64-bit integers.
- This method is intended for working with 64-bit floats.
- Returns a JSON representation of
- implicitly calls this function when stringifying a instance.
- The character encoding to use.
- The byte offset to start decoding at.
- The byte offset to stop decoding at (not inclusive).
- Decodes to a string according to the specified character encoding in
- and may be passed to decode only a subset of
- The maximum length of a string instance (in UTF-16 code units) is available as
- Creates and returns an for values (bytes).
- This function is called automatically when a is used in a statement.
- String to write to
- Number of bytes to skip before starting to write
- Number of bytes to write.
- The character encoding of
- Number of bytes written.
- Writes to at according to the character encoding in
- The parameter is the number of bytes to write.
- If did not contain enough space to fit the entire string, only part of will be written.
- However, partially encoded characters will not be written.
- Number to be written to
- plus the number of bytes written.
- Writes to at the specified with specified endian format (writes big endian, writes little endian).
- should be a valid 64-bit double.
- Behavior is undefined when is anything other than a 64-bit double.
- Writes to at the specified
- should be a valid signed 8-bit integer.
- is interpreted and written as a two's complement signed integer.
- Writes bytes of to at the specified
- Returns the maximum number of bytes that will be returned when is called.
- This can be overridden by user modules.
- See for more details on behavior.
- Note that this is a property on the module returned by, not on the global or a instance.
- The largest size allowed for a single instance.
- An alias for
- A or instance.
- The current encoding.
- To target encoding.
- Re-encodes the given or instance from one character encoding to another.
- Returns a new instance.
- Throws if the or specify invalid character encodings or if conversion from to is not permitted.
- The transcoding process will use substitution characters if a given byte sequence cannot be adequately represented in the target encoding.
- For instance:
- Because the Euro sign is not representable in US-ASCII, it is replaced with in the transcoded
- Returns an un-pooled
- In order to avoid the garbage collection overhead of creating many individually allocated instances, by default allocations under 4KB are sliced from a single larger allocated object.
- In the case where a developer may need to retain a small chunk of memory from a pool for an indeterminate amount of time, it may be appropriate to create an un-pooled instance using then copy out the relevant bits.
- Need to keep around a few small chunks of memory
- Allocate for retained data
- Copy the data into the new allocation
- Use of should be used only as a last resort after a developer has observed undue memory retention in their applications.
- The underlying memory for instances is not initialized
- The contents of a newly created are unknown and may contain sensitive data.
- Use to initialize a with zeroes.
- Note that is a property on the module returned by, not on the global or a instance.
- The largest size allowed for a single instance.
- On 32-bit architectures, this value is
- This value is also available as
- Represents the largest that a primitive can have, counted in UTF-16 code units.
- This value may depend on the JS engine that is being used.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement