How to use flash-store - 10 common examples

To help you get started, we’ve selected a few flash-store 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 huan / flash-store / tests / fixtures / smoke-testing.ts View on Github external
import {
  FlashStore,
  FlashStoreSync,
  VERSION,
}                   from 'flash-store'

if (VERSION === '0.0.0') {
  throw new Error('version should be set befoer publishing')
}

const store = new FlashStore()
store.destroy()

const storeSync = new FlashStoreSync()
storeSync.destroy()

console.info(`Smoke Testing v${store.version()} PASSED!`)
github huan / flash-store / tests / fixtures / smoke-testing.ts View on Github external
import {
  FlashStore,
  FlashStoreSync,
  VERSION,
}                   from 'flash-store'

if (VERSION === '0.0.0') {
  throw new Error('version should be set befoer publishing')
}

const store = new FlashStore()
store.destroy()

const storeSync = new FlashStoreSync()
storeSync.destroy()

console.info(`Smoke Testing v${store.version()} PASSED!`)
github huan / node-facenet / src / cache / face-cache.ts View on Github external
public init(): void {
    log.verbose('FaceCache', 'init()')

    if (!fs.existsSync(this.workdir)) {
      throw new Error(`directory not exist: ${this.workdir}`)
    }

    if (!this.store) {
      const storeName   = 'face-cache.store'
      this.store = new FlashStore(
        path.join(this.workdir, storeName),
      )
    }
    if (!this.embeddingStore) {
      const storeName   = 'face-cache-embedding.store'
      this.embeddingStore = new FlashStore(
        path.join(this.workdir, storeName),
      )
    }

    if (!this.imagedir) {
      const dirName = 'imagedir'
      this.imagedir = path.join(this.workdir, dirName)
      if (!fs.existsSync(this.imagedir)) {
        fs.mkdirSync(this.imagedir)
      }
    }
  }
github huan / node-facenet / src / cache / face-cache.ts View on Github external
public init(): void {
    log.verbose('FaceCache', 'init()')

    if (!fs.existsSync(this.workdir)) {
      throw new Error(`directory not exist: ${this.workdir}`)
    }

    if (!this.store) {
      const storeName   = 'face-cache.store'
      this.store = new FlashStore(
        path.join(this.workdir, storeName),
      )
    }
    if (!this.embeddingStore) {
      const storeName   = 'face-cache-embedding.store'
      this.embeddingStore = new FlashStore(
        path.join(this.workdir, storeName),
      )
    }

    if (!this.imagedir) {
      const dirName = 'imagedir'
      this.imagedir = path.join(this.workdir, dirName)
      if (!fs.existsSync(this.imagedir)) {
        fs.mkdirSync(this.imagedir)
      }
github juzibot / wechaty-puppet-macpro / src / cache-manager.ts View on Github external
'.wechaty',
      'puppet-macpro-cache',
      path.sep,
      'flash-store-v0.14',
      path.sep,
      userId,
    )

    const baseDirExist = await fs.pathExists(baseDir)

    if (!baseDirExist) {
      await fs.mkdirp(baseDir)
    }

    this.cacheContactRawPayload        = new FlashStore(path.join(baseDir, 'contact-raw-payload'))
    this.cacheRoomMemberRawPayload     = new FlashStore(path.join(baseDir, 'room-member-raw-payload'))
    this.cacheRoomRawPayload           = new FlashStore(path.join(baseDir, 'room-raw-payload'))
    this.cacheFile                     = new FlashStore(path.join(baseDir, 'file-cache'))
    this.cacheFriendshipRawPayload     = new FlashStore(path.join(baseDir, 'friendship'))

    const contactTotal = this.cacheContactRawPayload.size

    log.verbose(PRE, `initCache() inited ${await contactTotal} Contacts,  cachedir="${baseDir}"`)
  }
github juzibot / wechaty-puppet-macpro / src / cache-manager.ts View on Github external
path.sep,
      'flash-store-v0.14',
      path.sep,
      userId,
    )

    const baseDirExist = await fs.pathExists(baseDir)

    if (!baseDirExist) {
      await fs.mkdirp(baseDir)
    }

    this.cacheContactRawPayload        = new FlashStore(path.join(baseDir, 'contact-raw-payload'))
    this.cacheRoomMemberRawPayload     = new FlashStore(path.join(baseDir, 'room-member-raw-payload'))
    this.cacheRoomRawPayload           = new FlashStore(path.join(baseDir, 'room-raw-payload'))
    this.cacheFile                     = new FlashStore(path.join(baseDir, 'file-cache'))
    this.cacheFriendshipRawPayload     = new FlashStore(path.join(baseDir, 'friendship'))

    const contactTotal = this.cacheContactRawPayload.size

    log.verbose(PRE, `initCache() inited ${await contactTotal} Contacts,  cachedir="${baseDir}"`)
  }
github juzibot / wechaty-puppet-macpro / src / cache-manager.ts View on Github external
'puppet-macpro-cache',
      path.sep,
      'flash-store-v0.14',
      path.sep,
      userId,
    )

    const baseDirExist = await fs.pathExists(baseDir)

    if (!baseDirExist) {
      await fs.mkdirp(baseDir)
    }

    this.cacheContactRawPayload        = new FlashStore(path.join(baseDir, 'contact-raw-payload'))
    this.cacheRoomMemberRawPayload     = new FlashStore(path.join(baseDir, 'room-member-raw-payload'))
    this.cacheRoomRawPayload           = new FlashStore(path.join(baseDir, 'room-raw-payload'))
    this.cacheFile                     = new FlashStore(path.join(baseDir, 'file-cache'))
    this.cacheFriendshipRawPayload     = new FlashStore(path.join(baseDir, 'friendship'))

    const contactTotal = this.cacheContactRawPayload.size

    log.verbose(PRE, `initCache() inited ${await contactTotal} Contacts,  cachedir="${baseDir}"`)
  }
github wechaty / wechaty-puppet-padplus / src / server-manager / cache-manager.ts View on Github external
path.sep,
      '.wechaty',
      'puppet-padplus-cache',
      path.sep,
      'flash-store-v0.14',
      path.sep,
      userId,
    )

    const baseDirExist = await fs.pathExists(baseDir)

    if (!baseDirExist) {
      await fs.mkdirp(baseDir)
    }

    this.cacheWXID                     = new FlashStore(path.join(baseDir, 'accound-wxid'))
    this.cacheContactRawPayload        = new FlashStore(path.join(baseDir, 'contact-raw-payload'))
    this.cacheRoomMemberRawPayload     = new FlashStore(path.join(baseDir, 'room-member-raw-payload'))
    this.cacheRoomRawPayload           = new FlashStore(path.join(baseDir, 'room-raw-payload'))
    this.cacheFriendshipRawPayload     = new FlashStore(path.join(baseDir, 'friendship'))

    const contactTotal = this.cacheContactRawPayload.size

    log.verbose(PRE, `initCache() inited ${contactTotal} Contacts,  cachedir="${baseDir}"`)
  }
github wechaty / wechaty-puppet-padplus / src / server-manager / cache-manager.ts View on Github external
path.sep,
      'flash-store-v0.14',
      path.sep,
      userId,
    )

    const baseDirExist = await fs.pathExists(baseDir)

    if (!baseDirExist) {
      await fs.mkdirp(baseDir)
    }

    this.cacheWXID                     = new FlashStore(path.join(baseDir, 'accound-wxid'))
    this.cacheContactRawPayload        = new FlashStore(path.join(baseDir, 'contact-raw-payload'))
    this.cacheRoomMemberRawPayload     = new FlashStore(path.join(baseDir, 'room-member-raw-payload'))
    this.cacheRoomRawPayload           = new FlashStore(path.join(baseDir, 'room-raw-payload'))
    this.cacheFriendshipRawPayload     = new FlashStore(path.join(baseDir, 'friendship'))

    const contactTotal = this.cacheContactRawPayload.size

    log.verbose(PRE, `initCache() inited ${contactTotal} Contacts,  cachedir="${baseDir}"`)
  }
github juzibot / wechaty-puppet-macpro / src / cache-manager.ts View on Github external
'flash-store-v0.14',
      path.sep,
      userId,
    )

    const baseDirExist = await fs.pathExists(baseDir)

    if (!baseDirExist) {
      await fs.mkdirp(baseDir)
    }

    this.cacheContactRawPayload        = new FlashStore(path.join(baseDir, 'contact-raw-payload'))
    this.cacheRoomMemberRawPayload     = new FlashStore(path.join(baseDir, 'room-member-raw-payload'))
    this.cacheRoomRawPayload           = new FlashStore(path.join(baseDir, 'room-raw-payload'))
    this.cacheFile                     = new FlashStore(path.join(baseDir, 'file-cache'))
    this.cacheFriendshipRawPayload     = new FlashStore(path.join(baseDir, 'friendship'))

    const contactTotal = this.cacheContactRawPayload.size

    log.verbose(PRE, `initCache() inited ${await contactTotal} Contacts,  cachedir="${baseDir}"`)
  }

flash-store

FlashStore is a Key-Value persistent storage with easy to use ES6 Map-like API(both Async and Sync support), powered by LevelDB and TypeScript.

Apache-2.0
Latest version published 3 years ago

Package Health Score

36 / 100
Full package analysis