-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const fileItems = [ | ||
{ text: 'toDataURL', link: '/file/to-data-url' }, | ||
{ text: 'toText', link: '/file/to-text' }, | ||
{ text: 'toArrayBuffer', link: '/file/to-array-buffer' }, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# toArrayBuffer | ||
|
||
Converts a `File` object to an `ArrayBuffer`. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { toArrayBuffer } from 'rattail' | ||
|
||
const file = new File(['Hello, world!'], 'hello.txt', { type: 'text/plain' }) | ||
toArrayBuffer(file).then((arrayBuffer) => { | ||
console.log(arrayBuffer) | ||
}) | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------ | ------ | -------- | | ||
| `file` | `File` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| ---------------------- | | ||
| `Promise<ArrayBuffer>` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# toDataURL | ||
|
||
Converts a `File` object to a Data URL string. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { toDataURL } from 'rattail' | ||
|
||
const file = new File(['Hello, world!'], 'hello.txt', { type: 'text/plain' }) | ||
toDataURL(file).then((dataUrl) => { | ||
console.log(dataUrl) | ||
}) | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------ | ------ | -------- | | ||
| `file` | `File` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| ----------------- | | ||
| `Promise<string>` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# toText | ||
|
||
Converts a `File` object to a text string. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { toText } from 'rattail' | ||
|
||
const file = new File(['Hello, world!'], 'hello.txt', { type: 'text/plain' }) | ||
toText(file).then((text) => { | ||
console.log(text) | ||
}) | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------ | ------ | -------- | | ||
| `file` | `File` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| ----------------- | | ||
| `Promise<string>` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# toArrayBuffer | ||
|
||
将 `File` 对象转换为 `ArrayBuffer`。 | ||
|
||
### 用法 | ||
|
||
```ts | ||
import { toArrayBuffer } from 'rattail' | ||
|
||
const file = new File(['Hello, world!'], 'hello.txt', { type: 'text/plain' }) | ||
toArrayBuffer(file).then((arrayBuffer) => { | ||
console.log(arrayBuffer) | ||
}) | ||
``` | ||
|
||
### 参数 | ||
|
||
| 参数 | 类型 | 默认值 | | ||
| ------ | ------ | ------ | | ||
| `file` | `File` | | | ||
|
||
### 返回值 | ||
|
||
| 类型 | | ||
| ---------------------- | | ||
| `Promise<ArrayBuffer>` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# toDataURL | ||
|
||
将 `File` 对象转换为 Data URL 字符串。 | ||
|
||
### 用法 | ||
|
||
```ts | ||
import { toDataURL } from 'rattail' | ||
|
||
const file = new File(['Hello, world!'], 'hello.txt', { type: 'text/plain' }) | ||
toDataURL(file).then((dataUrl) => { | ||
console.log(dataUrl) | ||
}) | ||
``` | ||
|
||
### 参数 | ||
|
||
| 参数 | 类型 | 默认值 | | ||
| ------ | ------ | ------ | | ||
| `file` | `File` | | | ||
|
||
### 返回值 | ||
|
||
| 类型 | | ||
| ----------------- | | ||
| `Promise<string>` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# toText | ||
|
||
将 `File` 对象转换为文本字符串。 | ||
|
||
### 用法 | ||
|
||
```ts | ||
import { toText } from 'rattail' | ||
|
||
const file = new File(['Hello, world!'], 'hello.txt', { type: 'text/plain' }) | ||
toText(file).then((text) => { | ||
console.log(text) | ||
}) | ||
``` | ||
|
||
### 参数 | ||
|
||
| 参数 | 类型 | 默认值 | | ||
| ------ | ------ | ------ | | ||
| `file` | `File` | | | ||
|
||
### 返回值 | ||
|
||
| 类型 | | ||
| ----------------- | | ||
| `Promise<string>` | |