This is the reference point. All the other options are based off this.
|-- app
| |-- controllers
| | |-- admin
| import { join } from 'path' | |
| import { readdir, stat } from 'fs-promise' | |
| async function rreaddir (dir, allFiles = []) { | |
| const files = (await readdir(dir)).map(f => join(dir, f)) | |
| allFiles.push(...files) | |
| await Promise.all(files.map(async f => ( | |
| (await stat(f)).isDirectory() && rreaddir(f, allFiles) | |
| ))) | |
| return allFiles |
| // _____ __ _ _ | |
| ///__ \_ _ _ __ ___/ _\ ___ _ __(_)_ __ | |_ | |
| // / /\/ | | | '_ \ / _ \ \ / __| '__| | '_ \| __| | |
| // / / | |_| | |_) | __/\ \ (__| | | | |_) | |_ | |
| // \/ \__, | .__/ \___\__/\___|_| |_| .__/ \__| | |
| // |___/|_| |_| | |
| //Typescript Cheat Sheet: every syntax feature exemplified | |
| //variables are the same as javascript, but can be defined with a type: | |
| var myString:string; |
| // quite untested, adapted from BigstickCarpet's gist, attempt to make it simpler to use | |
| function openIndexedDB (fileindex) { | |
| // This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
| var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
| var openDB = indexedDB.open("MyDatabase", 1); | |
| openDB.onupgradeneeded = function() { | |
| var db = {} |