Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I think should have custom field in Header in namespace ChunkUpload #11

Open
huyp26102000 opened this issue Apr 10, 2022 · 0 comments
Open

Comments

@huyp26102000
Copy link

in \index.d.ts

export interface Header {
        "x-chunk-number": number;
        "x-chunk-total-number": number;
        "x-chunk-size": number;
        "x-file-name": string;
        "x-file-size": number;
        "x-file-identity": string;
        "custom": Object
    }

in \src\index.js

constructor(props) {
        this.data = {
            path: String(props.path),
            size: parseInt(props.size),
            fileName: String(props.fileName),
            fileSize: parseInt(props.fileSize),
            fileIdentity: this.generateFileIdentity(),
            fileShortId: null,
            destinationPath: RNFS.TemporaryDirectoryPath,
            totalNumber: 0,
            custom: props.custom,
        };
getHeaders(index) {
        return {
            "x-chunk-number" : index,
            "x-chunk-total-number" : this.data.totalNumber,
            "x-chunk-size" : this.data.size,
            "x-file-name" : this.data.fileName,
            "x-file-size" : this.data.fileSize,
            "x-file-identity" : this.data.fileIdentity,
            "custom": this.data.custom
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant