react-native-fs-turbo 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -102,12 +102,15 @@ import RNFSTurbo from 'react-native-fs-turbo';
102
102
  const pathUtf8 = `${RNFSTurbo.DocumentDirectoryPath}/test_utf8.txt`;
103
103
  const pathBase64 = `${RNFSTurbo.DocumentDirectoryPath}/test_base64.txt`;
104
104
  const pathUint8 = `${RNFSTurbo.DocumentDirectoryPath}/test_uint8.txt`;
105
+ const pathFloat32 = `${RNFSTurbo.DocumentDirectoryPath}/test_float32.txt`;
105
106
 
106
107
  try {
107
108
  RNFSTurbo.writeFile(path, 'Lorem ipsum dolor sit amet', 'utf8');
108
109
  RNFSTurbo.writeFile(path, 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQ=', 'base64');
109
110
  // An array with uint8 can be passed as input data
110
111
  RNFSTurbo.writeFile(path, [76, 111, 114, 101, 109, 32, 105, 112, 115, 117, 109, 32, 100, 111, 108, 111, 114, 32, 115, 105, 116, 32, 97, 109, 101, 116], 'uint8');
112
+ // An array with float32 can be passed as input data
113
+ RNFSTurbo.writeFile(path, [0.4233244061470032, 0.5435456037521362, 2.5345540046691895, 7.2343244552612305, 3.867867946624756, 0.7876875996589661], 'float32');
111
114
  } catch (err: Error) {
112
115
  console.log(err.message);
113
116
  }
@@ -275,39 +278,42 @@ type ReadDirItem = {
275
278
 
276
279
  Node.js style version of `readDir` that returns only the names. Note the lowercase `d`.
277
280
 
278
- ### `readFile(filepath: string, encoding?: 'utf8' | 'ascii' | 'base64' | 'uint8'): string | number[]`
281
+ ### `readFile(filepath: string, encoding?: 'utf8' | 'ascii' | 'base64' | 'uint8' | 'float32'): string | number[]`
279
282
 
280
- Reads the file at `path` and return contents. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`. Use `base64` or `uint8` for reading binary files.
283
+ Reads the file at `path` and return contents. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`. Use `base64` or `uint8` or `float32` for reading binary files.
281
284
 
282
285
  Note: you will take quite a performance hit if you are reading big files
283
286
 
284
- ### `read(filepath: string, length: number, position: number, encoding?: 'utf8' | 'ascii' | 'base64' | 'uint8'): string | number[]`
287
+ ### `read(filepath: string, length: number, position: number, encoding?: 'utf8' | 'ascii' | 'base64' | 'uint8' | 'float32'): string | number[]`
285
288
 
286
- Reads `length` bytes from the given `position` of the file at `path` and returns contents. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`. Use `base64` or `uint8` for reading binary files.
289
+ Reads `length` bytes from the given `position` of the file at `path` and returns contents. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`, `float32`. Use `base64` or `uint8` or `float32` for reading binary files.
287
290
 
288
291
  Note: reading big files piece by piece using this method may be useful in terms of performance.
292
+ Note: `float32` size is 4 bytes, so `position` and `length` should be specified in bytes (multiplied by 4)
289
293
 
290
- ### (Android only) `readFileAssets(filepath: string, encoding?: "utf8" | 'ascii' | "base64" | "uint8") => string[]`
294
+ ### (Android only) `readFileAssets(filepath: string, encoding?: "utf8" | 'ascii' | "base64") => string[]`
291
295
 
292
- Reads the file at `path` in the Android app's assets folder and return contents. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`. Use `base64` or `uint8` for reading binary files.
296
+ Reads the file at `path` in the Android app's assets folder and return contents. `encoding` can be one of `utf8` (default), `ascii`, `base64`. Use `base64` or `uint8` for reading binary files.
293
297
 
294
298
  `filepath` is the relative path to the file from the root of the `assets` folder.
295
299
 
296
- ### (Android only) `readFileRes: (filepath: string, encoding?: "utf8" | 'ascii' | "base64" | "uint8") => string[]`
300
+ ### (Android only) `readFileRes: (filepath: string, encoding?: "utf8" | 'ascii' | "base64") => string[]`
297
301
 
298
- Reads the file named `filename` in the Android app's `res` folder and return contents. Only the file name (not folder) needs to be specified. The file type will be detected from the extension and automatically located within `res/drawable` (for image files) or `res/raw` (for everything else). `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`. Use `base64` or `uint8` for reading binary files.
302
+ Reads the file named `filename` in the Android app's `res` folder and return contents. Only the file name (not folder) needs to be specified. The file type will be detected from the extension and automatically located within `res/drawable` (for image files) or `res/raw` (for everything else). `encoding` can be one of `utf8` (default), `ascii`, `base64`. Use `base64` for reading binary files.
299
303
 
300
- ### `writeFile(filepath: string, contents: string | number[], encoding?: "utf8" | 'ascii' | "base64" | "uint8"): void`
304
+ ### `writeFile(filepath: string, contents: string | number[], encoding?: "utf8" | 'ascii' | "base64" | "uint8" | "float32"): void`
301
305
 
302
- Write the `contents` to `filepath`. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`. `options` optionally takes an object specifying the file's properties, like mode etc.
306
+ Write the `contents` to `filepath`. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`, `float32`. `options` optionally takes an object specifying the file's properties, like mode etc.
303
307
 
304
- ### `appendFile(filepath: string, contents: string | number[], encoding?: "utf8" | 'ascii' | "base64" | "uint8"): void`
308
+ ### `appendFile(filepath: string, contents: string | number[], encoding?: "utf8" | 'ascii' | "base64" | "uint8" | "float32"): void`
305
309
 
306
- Append the `contents` to `filepath`. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`.
310
+ Append the `contents` to `filepath`. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`, `float32`.
307
311
 
308
- ### `write(filepath: string, contents: string | number[], position?: number, encoding?: "utf8" | "base64" | "uint8"): void`
312
+ ### `write(filepath: string, contents: string | number[], position?: number, encoding?: "utf8" | "base64" | "uint8" | "float32"): void`
309
313
 
310
- Write the `contents` to `filepath` at the given random access position. When `position` is `undefined` or `-1` the contents is appended to the end of the file. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`.
314
+ Write the `contents` to `filepath` at the given random access position. When `position` is `undefined` or `-1` the contents is appended to the end of the file. `encoding` can be one of `utf8` (default), `ascii`, `base64`, `uint8`, `float32`.
315
+
316
+ Note: `float32` size is 4 bytes, so `position` should be specified in bytes (multiplied by 4)
311
317
 
312
318
  ### `moveFile(filepath: string, destPath: string): void`
313
319
 
package/RNFSTurbo.podspec CHANGED
@@ -16,6 +16,7 @@ Pod::Spec.new do |s|
16
16
  "ios/**/*.{h,m,mm}",
17
17
  "cpp/**/*.{hpp,cpp,c,h}",
18
18
  ]
19
+ s.resource_bundles = { 'RNFS_PrivacyInfo' => 'ios/PrivacyInfo.xcprivacy' }
19
20
  s.compiler_flags = '-x objective-c++'
20
21
  s.frameworks = 'Photos'
21
22
  s.pod_target_xcconfig = {