@hxa-rn/rn-fetch-blob 0.12.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/LICENSE +21 -0
- package/README.md +290 -0
- package/harmony/fetch_blob/LICENSE +21 -0
- package/harmony/fetch_blob/NOTICE +33 -0
- package/harmony/fetch_blob/OAT.xml +38 -0
- package/harmony/fetch_blob/build-profile.json5 +16 -0
- package/harmony/fetch_blob/hvigorfile.ts +2 -0
- package/harmony/fetch_blob/index.ets +1 -0
- package/harmony/fetch_blob/oh-package.json5 +14 -0
- package/harmony/fetch_blob/src/main/cpp/CMakeLists.txt +15 -0
- package/harmony/fetch_blob/src/main/cpp/FetchBlobPackage.h +13 -0
- package/harmony/fetch_blob/src/main/cpp/generated/RNOH/generated/BaseFetchBlobPackage.h +72 -0
- package/harmony/fetch_blob/src/main/cpp/generated/RNOH/generated/turbo_modules/RNFetchBlob.cpp +55 -0
- package/harmony/fetch_blob/src/main/cpp/generated/RNOH/generated/turbo_modules/RNFetchBlob.h +16 -0
- package/harmony/fetch_blob/src/main/ets/FetchBlobTurboModulesFactory.ets +18 -0
- package/harmony/fetch_blob/src/main/ets/Logger.ts +40 -0
- package/harmony/fetch_blob/src/main/ets/RNFetchBlobConfig.ts +45 -0
- package/harmony/fetch_blob/src/main/ets/RNFetchBlobFS.ts +673 -0
- package/harmony/fetch_blob/src/main/ets/RNFetchBlobImpl.ts +246 -0
- package/harmony/fetch_blob/src/main/ets/RNFetchBlobReq.ts +530 -0
- package/harmony/fetch_blob/src/main/ets/RNFetchBlobStream.ts +169 -0
- package/harmony/fetch_blob/src/main/ets/RNFetchBlobTurboModule.ts +192 -0
- package/harmony/fetch_blob/src/main/ets/generated/index.ets +5 -0
- package/harmony/fetch_blob/src/main/ets/generated/ts.ts +5 -0
- package/harmony/fetch_blob/src/main/ets/generated/turboModules/RNFetchBlob.ts +92 -0
- package/harmony/fetch_blob/src/main/ets/generated/turboModules/ts.ts +5 -0
- package/harmony/fetch_blob/src/main/module.json5 +22 -0
- package/harmony/fetch_blob/src/main/resources/base/element/string.json +8 -0
- package/harmony/fetch_blob/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/fetch_blob/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/fetch_blob.har +0 -0
- package/package.json +59 -0
- package/src/android.js +62 -0
- package/src/class/RNFetchBlobFile.js +17 -0
- package/src/class/RNFetchBlobReadStream.js +82 -0
- package/src/class/RNFetchBlobSession.js +74 -0
- package/src/class/RNFetchBlobWriteStream.js +57 -0
- package/src/class/StatefulPromise.js +7 -0
- package/src/fs.js +432 -0
- package/src/index.d.ts +690 -0
- package/src/index.js +577 -0
- package/src/ios.js +54 -0
- package/src/json-stream.js +45 -0
- package/src/lib/oboe-browser.min.js +1 -0
- package/src/polyfill/Blob.js +362 -0
- package/src/polyfill/Event.js +11 -0
- package/src/polyfill/EventTarget.js +79 -0
- package/src/polyfill/Fetch.js +213 -0
- package/src/polyfill/File.js +27 -0
- package/src/polyfill/FileReader.js +90 -0
- package/src/polyfill/ProgressEvent.js +32 -0
- package/src/polyfill/XMLHttpRequest.js +446 -0
- package/src/polyfill/XMLHttpRequestEventTarget.js +118 -0
- package/src/polyfill/index.js +11 -0
- package/src/specs/v1/NativeRNFetchBlob.ts +85 -0
- package/src/types.js +64 -0
- package/src/utils/log.js +40 -0
- package/src/utils/unicode.js +7 -0
- package/src/utils/uri.js +28 -0
- package/src/utils/uuid.js +4 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* HarmonyOS adaptation of rn-fetch-blob (RNFetchBlob TurboModule).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import hilog from '@ohos.hilog';
|
|
8
|
+
|
|
9
|
+
class Logger {
|
|
10
|
+
private domain: number;
|
|
11
|
+
private prefix: string;
|
|
12
|
+
private format: string = '%{public}s, %{public}s';
|
|
13
|
+
private isDebug: boolean;
|
|
14
|
+
|
|
15
|
+
constructor(prefix: string = 'RNFetchBlob', domain: number = 0xFF00, isDebug = false) {
|
|
16
|
+
this.prefix = prefix;
|
|
17
|
+
this.domain = domain;
|
|
18
|
+
this.isDebug = isDebug;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
debug(...args: string[]): void {
|
|
22
|
+
if (this.isDebug) {
|
|
23
|
+
hilog.debug(this.domain, this.prefix, this.format, args);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
info(...args: string[]): void {
|
|
28
|
+
hilog.info(this.domain, this.prefix, this.format, args);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
warn(...args: string[]): void {
|
|
32
|
+
hilog.warn(this.domain, this.prefix, this.format, args);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
error(...args: string[]): void {
|
|
36
|
+
hilog.error(this.domain, this.prefix, this.format, args);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default new Logger('RNFetchBlob', 0xFF00, false);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026. All rights reserved.
|
|
3
|
+
* HarmonyOS adaptation of rn-fetch-blob (RNFetchBlob TurboModule).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Request configuration passed from JS side (RNFetchBlobConfig in index.js).
|
|
8
|
+
* Field semantics mirror the Android implementation (RNFetchBlobConfig.java).
|
|
9
|
+
*/
|
|
10
|
+
export class RNFetchBlobConfig {
|
|
11
|
+
Progress?: Object;
|
|
12
|
+
UploadProgress?: Object;
|
|
13
|
+
fileCache?: boolean;
|
|
14
|
+
path?: string;
|
|
15
|
+
appendExt?: string;
|
|
16
|
+
session?: string;
|
|
17
|
+
addAndroidDownloads?: Object = {};
|
|
18
|
+
overwrite?: boolean = true;
|
|
19
|
+
indicator?: boolean = false;
|
|
20
|
+
timeout?: number = 60000;
|
|
21
|
+
followRedirect?: boolean = true;
|
|
22
|
+
trusty?: boolean;
|
|
23
|
+
wifiOnly?: boolean = false;
|
|
24
|
+
auto?: boolean;
|
|
25
|
+
key?: string;
|
|
26
|
+
binaryContentTypes?: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Response representation type: 'text' | 'blob' | 'json' | ''.
|
|
31
|
+
*/
|
|
32
|
+
export type RespType = 'text' | 'blob' | 'json' | '';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Response info emitted to JS via the RNFetchBlobState event (state === 2).
|
|
36
|
+
*/
|
|
37
|
+
export class ResponseInfo {
|
|
38
|
+
taskId: string = '';
|
|
39
|
+
state: number = 0;
|
|
40
|
+
headers: Object = {};
|
|
41
|
+
status: number = 0;
|
|
42
|
+
timeout: boolean = false;
|
|
43
|
+
redirects: string[] = [];
|
|
44
|
+
respType: RespType = '';
|
|
45
|
+
}
|