Commit 42f4d0f5 authored by Sebastian Hönel's avatar Sebastian Hönel

Add deployer

parent 838a2fd2
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/file-encryptor/file-encryptor.d.ts" />
/// <reference path="../typings/request/request.d.ts" />
import Fs = require('fs');
import Encryptor = require('file-encryptor');
import Request = require('request');
export class Deployer {
public constructor(private endpointUri: string, private password: string) {
};
public deploy(data: Fs.ReadStream): Promise<void> {
return new Promise<void>((resolve, reject) => {
const request = data.pipe(Request.post(this.endpointUri));
request.on('response', (response: any) => {
if (response.statusCode === 200) {
resolve();
}
reject('Unknown error occurred.');
});
request.on('error', (e: any) => reject(e));
});
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment