# Using SDS with the Node.js

# Uploading a document

// HTTP POST PDF to Signicat SDS
// using Node.js (http://nodejs.org)
// and the request library (https://github.com/mikeal/request)

var fs = require('fs');
var request = require('request');

fs.createReadStream('mydocument.pdf').pipe(
    request.post(
        'https://preprod.signicat.com/doc/demo/sds/',
        function (error, response, body) {
            if (!error && response.statusCode == 201) {
                console.log(body);
            }
            else {
                console.log(error);
            }
        }
    ).auth(
        'demo',
        'Bond007'
    )
);

# Downloading a document

// HTTP GET PDF from Signicat SDS
// using Node.js (http://nodejs.org)
// and the request library (https://github.com/mikeal/request)
var fs = require('fs');
var request = require('request');

var url = 'https://preprod.signicat.com/doc/demo/sds/23082013f7mycvs9u35wrwg954qa9wmsn50mtwlatf3ygjy09yj8kkp3q';
request(url).auth('demo', 'Bond007').pipe(fs.createWriteStream('mydownloadedfile.pdf'));
Last updated: 1/12/2021, 11:14:41 AM