Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ yarn-error.log
# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
# Testing
/coverage

# Yarn
Expand All @@ -79,3 +79,6 @@ yarn-error.log
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Builder Bob
lib/
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,28 @@ npm install react-native-fast-io --save
- Streams, e.g. `web-streams-polyfill/polyfill`
- AsyncIterator, e.g. `@azure/core-asynciterator-polyfill`

## Usage
### Usage

This library includes:
- [`WebSocket`](docs/ws.md)
- [`fetch`](docs/network.md)
- [`Blob`](docs/blob.md)
- [`ReadableStream` and `WritableStream`](docs/streams.md)
```ts
// With `unstable_enablePackageExports` enabled
import { WebSocket } from 'react-native-fast-io/ws'

For details, consult each module's documentation. Unless otherwise specified, all methods work as per W3C specifications.
// Otherwise
import { WebSocket } from 'react-native-fast-io'
```

## What's included

| Name | Docs | W3C | Status |
|------|------|-----|--------|
| WebSocket | [📖](docs/ws.md) | [WebSocket API](https://websockets.spec.whatwg.org/) | Beta ✅ |
| Fetch | [📖](docs/fetch.md) | [Fetch API](https://fetch.spec.whatwg.org/) | Work In Progress 🚧 |
| FileSystem | [📖](docs/fs.md) | [File System Access API](https://wicg.github.io/file-system-access/) | Work In Progress 🚧 |
| Blob | [📖](docs/blob.md) | [Blob API](https://w3c.github.io/FileAPI/#blob-section) | Work In Progress 🚧 |
| Streams | [📖](docs/streams.md) | [Streams API](https://streams.spec.whatwg.org/) | Work In Progress 🚧 |

> [!TIP]
> Unless otherwise specified, all methods work as per W3C specifications. For details, consult each module's documentation.

## Made with ❤️ at Callstack

Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions docs/fs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Fs

## Usage

[TBD]

## Differences with `react-native-document-picker`

[TBD]

## Differences with `expo-file-system`

[TBD]
2 changes: 1 addition & 1 deletion example/tests/benchmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TouchableOpacity,
View,
} from 'react-native'
import { WebSocket as FastWS } from 'react-native-fast-io'
import { WebSocket as FastWS } from 'react-native-fast-io/ws'

import {
CHAT_PAYLOAD,
Expand Down
11 changes: 4 additions & 7 deletions example/tests/filesystem.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import React, { useState } from 'react'
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import {
CompressionStream,
fetch,
OpenFilePickerOptions,
showOpenFilePicker,
} from 'react-native-fast-io'
import { fetch } from 'react-native-fast-io/fetch'
import { showOpenFilePicker } from 'react-native-fast-io/fs'
import { CompressionStream } from 'react-native-fast-io/streams'

import { BASE_URL } from './benchmark'

export function FileSystemUI() {
const [file, setFile] = useState<File | null>(null)

const pickFile = async (options?: OpenFilePickerOptions) => {
const pickFile = async (options?: Parameters<typeof showOpenFilePicker>[0]) => {
const [fileHandle] = await showOpenFilePicker(options)
const file = await fileHandle.getFile()
// @ts-ignore
Expand Down
9 changes: 8 additions & 1 deletion example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"extends": ".."
"extends": "..",
"compilerOptions": {
"resolvePackageJsonExports": false,
"paths": {
"react-native-fast-io": ["../packages/react-native-fast-io/src/index.ts"],
"react-native-fast-io/*": ["../packages/react-native-fast-io/src/w3c/*"]
}
}
}
Loading