Skip to content

Instantly share code, notes, and snippets.

@jordanwalsh23
Created May 4, 2017 01:33
Show Gist options
  • Select an option

  • Save jordanwalsh23/93577aef49274061904a6ded22345947 to your computer and use it in GitHub Desktop.

Select an option

Save jordanwalsh23/93577aef49274061904a6ded22345947 to your computer and use it in GitHub Desktop.
Developers Guide to Lending - Snippet 8
//Dependencies
const fs = require('fs')
//Attach the loan agreement to the Contact
let loanContract = {
FileName: "loanContract.pdf",
MimeType: "application/pdf"
}
let filePath = "/path/to/some/loanContract.pdf"
let fileReadStream = fs.createReadStream(filePath)
let attachmentObj = xeroClient.core.attachments.newAttachment(loanContract)
return attachmentObj.save(`Contacts/${contactID}`, fileReadStream, true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment