How to use the tsubaki.promisify function in tsubaki

To help you get started, we’ve selected a few tsubaki examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appellation / handles / src / core / CommandRegistry.ts View on Github external
import { promisify } from 'tsubaki';

import { IConfig } from '../interfaces/Config';
import Command, { Trigger } from '../structures/Command';
import HandlesClient from './Client';

import fs = require('fs');
import path = require('path');

const readdir: (dir: string) => Promise = promisify(fs.readdir);
const stat: (path: string) => Promise = promisify(fs.stat);

/**
 * Manage command loading.
 */
export default class CommandRegistry extends Map {

  /**
   * Get all the file paths recursively in a directory.
   * @param dir The directory to start at.
   */
  private static async _loadDir(dir: string): Promise {
    const files = await readdir(dir);
    const list: string[] = [];

    await Promise.all(files.map(async (f) => {
github appellation / handles / src / core / CommandRegistry.ts View on Github external
import { promisify } from 'tsubaki';

import { IConfig } from '../interfaces/Config';
import Command, { Trigger } from '../structures/Command';
import HandlesClient from './Client';

import fs = require('fs');
import path = require('path');

const readdir: (dir: string) => Promise = promisify(fs.readdir);
const stat: (path: string) => Promise = promisify(fs.stat);

/**
 * Manage command loading.
 */
export default class CommandRegistry extends Map {

  /**
   * Get all the file paths recursively in a directory.
   * @param dir The directory to start at.
   */
  private static async _loadDir(dir: string): Promise {
    const files = await readdir(dir);
    const list: string[] = [];

    await Promise.all(files.map(async (f) => {
      const currentPath = path.join(dir, f);

tsubaki

Promisify with native promises.

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular tsubaki functions