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)
  1. 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.

  • File-system
  • Http
  • Express

var app = require(‘express’)();

var http = require(‘http’);

var fs = require(‘file-system’);


var file = fs.createWriteStream(path to save the file in your file system);

var options = {

Host: servername (domino),

path: path of the attachment in domino,

method: ‘GET’,

headers: {

‘Host’: servername (domino),



var request = http.request(options, function (res) {


res.on(‘end’, function () {





  1. GridFS:

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

  • Mongodb
  • gridFs

var mongo = require(‘mongodb’);

var Grid = require(‘gridfs’);


mongo.MongoClient.connect(mongourl , function (err, db) {

if (err) {


return false;


var gfs = Grid(db, mongo);



content_type: ‘image/png’

},, function (err, fileDetail) {

if (err) {


return false;


console.log(‘File save to GridFs’);




Maarga is a boutique consultancy with deep expertise in Lotus Notes migration, digital transformation and enterprise collaboration. Reach out to Maarga with your needs at