tests/bulk_data.test.js
/**
     * Starts an export and waits for it. Then downloads the file at the given
     * index. NOTE: this method assumes that the index exists and will throw
     * otherwise.
     * @param {string} fileUrl The index of the file in the status list
     */
Starts an export and waits for it. Then downloads the file at the given
index. NOTE: this method assumes that the index exists and will throw
otherwise.
@param {string} fileUrl The index of the file in the status list
Starts an export and waits for it . Then downloads the file at the given index . NOTE : this method assumes that the index exists and will throw otherwise . @param { string } fileUrl The index of the file in the status list
async downloadFile(fileUrl, accessToken = null, fileError = null) {
        if (fileError) {
            let sim = fileUrl.match(/^http\:\/\/.*?\/(.*?)\/fhir/)[1];
            sim = base64url.decode(sim);
            sim = JSON.parse(sim);
            sim.fileError = fileError;
            sim = JSON.stringify(sim);
            sim = base64url.encode(sim);
            fileUrl = fileUrl.replace(/^(http:\/\/.*?)\/(.*?)\/fhir/, "$1/" + sim + "/fhir/");
        }
        const res = await lib.requestPromise({
            uri: fileUrl,
            gzip: true,
            headers: {
                accept: "application/fhir+ndjson",
                authorization: accessToken ? `Bearer ${accessToken}` : undefined
            }
        });
        res.lines = res.body.split(/\n/).map(l => l.trim()).filter(Boolean);
        return res;
    }
async downloadFile ( fileUrl , accessToken = null , fileError = null ) { if ( fileError ) { let sim = fileUrl . match ( / ^http\:\/\/.*?\/(.*?)\/fhir / ) [ 1 ] ; sim = base64url . decode ( sim ) ; sim = JSON . parse ( sim ) ; sim . fileError = fileError ; sim = JSON . stringify ( sim ) ; sim = base64url . encode ( sim ) ; fileUrl = fileUrl . replace ( / ^(http:\/\/.*?)\/(.*?)\/fhir / , "$1/" + sim + "/fhir/" ) ; } const res = await lib . requestPromise ( { uri : fileUrl , gzip : true , headers : { accept : "application/fhir+ndjson" , authorization : accessToken ? ` ${ accessToken } ` : undefined } } ) ; res . lines = res . body . split ( / \n / ) . map ( l => l . trim ( ) ) . filter ( Boolean ) ; return res ; }
Starts an export and waits for it.
Starts an export and waits for it .
// @ts-ignore // json: true,