Skip to content

Commit

Permalink
added support for strings
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Nov 14, 2020
1 parent 548bd85 commit ca635a8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2,529 deletions.
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# toab
To Array Buffer: Convert Buffer, Data URLs, Files and Typed Arrays to Array Buffers

To Array Buffer: Convert Buffer, Data URLs, Files, Text, and Typed Arrays to Array Buffers
# install
```bash
npm install toab
Expand Down Expand Up @@ -34,14 +33,19 @@ const arrayBuffer = await toab(url);

# convert typed arrays to array buffers
```javascript
toab(Int8Array)
toab(Uint8Array)
toab(Int16Array)
toab(Uint16Array)
toab(Int32Array)
toab(Uint32Array)
toab(Float32Array)
toab(Float64Array)
toab(BigInt64Array)
toab(BigUint64Array)
const arrayBuffer = toab(Int8Array)
const arrayBuffer = toab(Uint8Array)
const arrayBuffer = toab(Int16Array)
const arrayBuffer = toab(Uint16Array)
const arrayBuffer = toab(Int32Array)
const arrayBuffer = toab(Uint32Array)
const arrayBuffer = toab(Float32Array)
const arrayBuffer = toab(Float64Array)
const arrayBuffer = toab(BigInt64Array)
const arrayBuffer = toab(BigUint64Array)
```

# convert text to an array buffer (in UTF-8)
```javascript
const arrayBuffer = toab("Hello, I'm a String.");
```
Loading

0 comments on commit ca635a8

Please sign in to comment.