Skip to content

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

@hiro2k-dev

Description

@hiro2k-dev

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
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions