In order to extract attachments or files from IBM Domino we can use the following methods,
- Using Agents and transfer file data as base64 to Node or Mongodb.
- Using http connection between node and Domino and accessing the file through its URL
The authentication part can be handled either by user authentication or Domino Web Server Application Programming Interface (DSAPI).
Why to handle the attachments in Node or Mongodb?
This is because, each service call that we make to Domino is very costly comparing to a service call in Mongodb or within node itself. So we prefer saving or handling attachments from Node or Mongodb for future use of the file or attachment.
How to handle the attachments in Node or Mongodb?
There are two methods to handle attachments,
- Using File System(node)
- GridFS (Mongodb)
- File Systems:
In this method we will use the node.js API file-system using which we will save the attachments from Domino to the file systems of our node server.
To do so we need to install the following API into our server using npm.
GridFS is a specification for storing and retrieving files that exceed the BSON -document size limit of 16 MB.
Instead of storing a file in a single document, GridFS divides the file into parts, or chunks, and stores each chunk as a separate document. By default, GridFS uses a chunk size of 255 kB; that is, GridFS divides a file into chunks of 255 kB with the exception of the last chunk. The last chunk is only as large as necessary. Similarly, files that are no larger than the chunk size only have a final chunk, using only as much space as needed plus some additional metadata.
In MongoDB, GridFS is used for storing files larger than 16 MB. As soon as you get the file or attachments data from IBM Domino, just push the data as file into to grid fs of mongodb.
To store file in Mongodb GridFS we are going to use the following API’s