Skip to content

Commit 7cd2efe

Browse files
Update getAttachmentAndSave.js
1 parent c2e41fc commit 7cd2efe

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

UsesCases/Attachments/get/getAttachmentAndSave.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77
// 7. Perform some action after successful retrieving attachmwent file name using getDownloadDocumentAttachmentByIndex() function
88
// 8. Save response body to local file name
99
// All values of variables starting with "YOUR_****" should be replaced by real user values
10-
11-
import credentials from "../../../../Credentials/credentials.json" with { type: "json" }; // json-file in this format: { "id": "*****", "key": "*******" }
12-
import fs from "node:fs/promises";
13-
import path from "node:path";
14-
import { PdfApi } from "../../../src/api/api.js";
10+
import credentials from "./credentials.json" with { type: "json" };
11+
import fs from 'node:fs/promises';
12+
import path from 'node:path';
13+
import { PdfApi } from "asposepdfcloud";
1514

1615
const configParams = {
1716
LOCAL_FOLDER: "C:\\Samples\\",
1817
PDF_DOCUMENT_NAME: "sample_file_with_attachment.pdf",
1918
LOCAL_RESULT_DOCUMENT_NAME: "output_sample.pdf",
20-
ATTACHMENT_PATH: "",
19+
ATTACHMENT_PATH: "", // filed will be setting by using attachments.list[0].links[0].href after call getDocumentAttachments() function
2120
};
2221

2322
const pdfApi = new PdfApi(credentials.id, credentials.key);
@@ -76,4 +75,4 @@ async function main() {
7675
}
7776
}
7877

79-
main();
78+
main();

0 commit comments

Comments
 (0)