BLUE
PHP 7.4.33
Path:
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/react-native/Libraries/Blob
Run
Logout
Edit File
Size: 3.99 KB
Close
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/react-native/Libraries/Blob/FileReader.js
Text
Base64
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ import type Blob from './Blob'; import NativeFileReaderModule from './NativeFileReaderModule'; import {toByteArray} from 'base64-js'; import EventTarget from 'event-target-shim'; type ReadyState = | 0 // EMPTY | 1 // LOADING | 2; // DONE type ReaderResult = string | ArrayBuffer; const READER_EVENTS = [ 'abort', 'error', 'load', 'loadstart', 'loadend', 'progress', ]; const EMPTY = 0; const LOADING = 1; const DONE = 2; class FileReader extends (EventTarget(...READER_EVENTS): typeof EventTarget) { static EMPTY: number = EMPTY; static LOADING: number = LOADING; static DONE: number = DONE; EMPTY: number = EMPTY; LOADING: number = LOADING; DONE: number = DONE; _readyState: ReadyState; _error: ?Error; _result: ?ReaderResult; _aborted: boolean = false; constructor() { super(); this._reset(); } _reset(): void { this._readyState = EMPTY; this._error = null; this._result = null; } _setReadyState(newState: ReadyState) { this._readyState = newState; this.dispatchEvent({type: 'readystatechange'}); if (newState === DONE) { if (this._aborted) { this.dispatchEvent({type: 'abort'}); } else if (this._error) { this.dispatchEvent({type: 'error'}); } else { this.dispatchEvent({type: 'load'}); } this.dispatchEvent({type: 'loadend'}); } } readAsArrayBuffer(blob: ?Blob): void { this._aborted = false; if (blob == null) { throw new TypeError( "Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'", ); } NativeFileReaderModule.readAsDataURL(blob.data).then( (text: string) => { if (this._aborted) { return; } const base64 = text.split(',')[1]; const typedArray = toByteArray(base64); this._result = typedArray.buffer; this._setReadyState(DONE); }, error => { if (this._aborted) { return; } this._error = error; this._setReadyState(DONE); }, ); } readAsDataURL(blob: ?Blob): void { this._aborted = false; if (blob == null) { throw new TypeError( "Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'", ); } NativeFileReaderModule.readAsDataURL(blob.data).then( (text: string) => { if (this._aborted) { return; } this._result = text; this._setReadyState(DONE); }, error => { if (this._aborted) { return; } this._error = error; this._setReadyState(DONE); }, ); } readAsText(blob: ?Blob, encoding: string = 'UTF-8'): void { this._aborted = false; if (blob == null) { throw new TypeError( "Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'", ); } NativeFileReaderModule.readAsText(blob.data, encoding).then( (text: string) => { if (this._aborted) { return; } this._result = text; this._setReadyState(DONE); }, error => { if (this._aborted) { return; } this._error = error; this._setReadyState(DONE); }, ); } abort() { this._aborted = true; // only call onreadystatechange if there is something to abort, as per spec if (this._readyState !== EMPTY && this._readyState !== DONE) { this._reset(); this._setReadyState(DONE); } // Reset again after, in case modified in handler this._reset(); } get readyState(): ReadyState { return this._readyState; } get error(): ?Error { return this._error; } get result(): ?ReaderResult { return this._result; } } module.exports = FileReader;
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 20
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__mocks__
DIR
-
drwxr-xr-x
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Blob.js
4.47 KB
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BlobManager.js
4.92 KB
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BlobRegistry.js
784 B
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BlobTypes.js
535 B
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
File.js
1.07 KB
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FileReader.js
3.99 KB
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
NativeBlobModule.js
408 B
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
NativeFileReaderModule.js
432 B
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RCTBlobCollector.h
594 B
lrw-r--r--
2025-03-28 11:04:41
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RCTBlobCollector.mm
1.96 KB
lrw-r--r--
2025-03-28 11:04:43
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RCTBlobManager.h
1001 B
lrwxr-xr-x
2025-03-28 11:04:41
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RCTBlobManager.mm
9.87 KB
lrwxr-xr-x
2025-03-28 11:04:43
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RCTBlobPlugins.h
938 B
lrw-r--r--
2025-03-28 11:04:41
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RCTBlobPlugins.mm
901 B
lrw-r--r--
2025-03-28 11:04:43
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RCTFileReaderModule.h
292 B
lrw-r--r--
2025-03-28 11:04:41
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RCTFileReaderModule.mm
2.83 KB
lrw-r--r--
2025-03-28 11:04:43
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
React-RCTBlob.podspec
2.69 KB
lrw-r--r--
2025-03-28 11:04:43
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
URL.js
4.46 KB
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
URLSearchParams.js
1.79 KB
lrw-r--r--
2025-03-28 11:04:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
URLSearchParams.js.flow
606 B
lrw-r--r--
2025-03-28 11:04:41
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).