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
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ npm install react-native-fast-io --save

- React Native 0.76 or higher
- Nitro Modules
- Polyfills:
- TextDecoder, e.g. `@bacons/text-decoder`
- Streams, e.g. `web-streams-polyfill/polyfill`
- AsyncIterator, e.g. `@azure/core-asynciterator-polyfill`

### Usage

Expand Down
2 changes: 0 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import '@bacons/text-decoder/install'
import 'web-streams-polyfill/polyfill'
import '@azure/core-asynciterator-polyfill'

import { AppRegistry } from 'react-native'
Expand Down
5 changes: 1 addition & 4 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@
"server": "bun server/index.ts"
},
"dependencies": {
"@azure/core-asynciterator-polyfill": "^1.0.2",
"@bacons/text-decoder": "^0.0.0",
"cli-table3": "^0.6.5",
"react": "18.3.1",
"react-native": "0.76.0",
"react-native-fast-io": "0.1.1",
"react-native-nitro-modules": "^0.15.0",
"web-streams-polyfill": "^4.0.0"
"react-native-nitro-modules": "^0.15.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
2 changes: 1 addition & 1 deletion example/tests/filesystem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import { fetch } from 'react-native-fast-io/fetch'
import { showOpenFilePicker } from 'react-native-fast-io/fs'
import { File, showOpenFilePicker } from 'react-native-fast-io/fs'
import { CompressionStream } from 'react-native-fast-io/streams'

import { BASE_URL } from './benchmark'
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native-fast-io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
"react-native-nitro-modules": "^0.15.0"
},
"dependencies": {
"event-target-shim": "^6.0.2"
"event-target-shim": "^6.0.2",
"@bacons/text-decoder": "^0.0.0",
"web-streams-polyfill": "^4.0.0"
},
"devDependencies": {
"nitro-codegen": "^0.15.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/react-native-fast-io/src/w3c/blob.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { ReadableStream } from './streams'
import { TextDecoder } from './text'

export class Blob implements globalThis.Blob {
private parts: Array<BlobPart>

Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-fast-io/src/w3c/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Network, RequestMethod } from '../native/network.nitro'
import { Blob } from './blob'
import { fromReadableStream } from './streams'
import { File } from './fs'
import { fromReadableStream, ReadableStream } from './streams'

export function fetch(
url: string,
Expand Down
4 changes: 4 additions & 0 deletions packages/react-native-fast-io/src/w3c/streams.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ReadableStream, TransformStream, WritableStream } from 'web-streams-polyfill'

import { CompressorFactory, DuplexStream, InputStream, OutputStream } from '../native/streams.nitro'

export const toReadableStream = (inputStream: InputStream) => {
Expand Down Expand Up @@ -76,3 +78,5 @@ export class CompressionStream implements globalThis.CompressionStream {
this.writable = writable
}
}

export { ReadableStream, TransformStream, WritableStream }
3 changes: 3 additions & 0 deletions packages/react-native-fast-io/src/w3c/text.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { TextDecoder } from '@bacons/text-decoder'

export const TextEncoder = globalThis.TextEncoder