@bravemobile/react-native-code-push
Version:
React Native plugin for the CodePush service
20 lines (19 loc) • 624 B
JavaScript
/**
* code based on appcenter-cli
*/
import fs from "fs";
export function isDirectory(path) {
return fs.statSync(path).isDirectory();
}
export function generateRandomFilename(length) {
let filename = '';
const validChar = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < length; i++) {
filename += validChar.charAt(Math.floor(Math.random() * validChar.length));
}
return filename;
}
export function normalizePath(filePath) {
//replace all backslashes coming from cli running on windows machines by slashes
return filePath.replace(/\\/g, '/');
}