Files
flipper/src/utils/openssl-wrapper-with-promises.tsx
Pascal Hartig 610a926611 Migrate openssl-wrapper-with-promises
Summary: _typescript_

Reviewed By: danielbuechele

Differential Revision: D16781986

fbshipit-source-id: 1d07e3d71b7fabd4e0559007846b2a0c4a10a45e
2019-08-14 04:43:51 -07:00

25 lines
668 B
TypeScript

/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import {exec as opensslWithCallback} from 'openssl-wrapper';
import child_process from 'child_process';
export function openssl(action: string, options: {}): Promise<string> {
return new Promise((resolve, reject) => {
opensslWithCallback(action, options, (err, buffer) => {
if (err) {
reject(err);
}
resolve(buffer.toString());
});
});
}
export function isInstalled(): boolean {
return !child_process.spawnSync('openssl', ['version']).error;
}