@hbtv/file-storage
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    @hbtv/file-storage

    主要解决在 umijs mock 辅助存储的问题

    安装

    npm install @hbtv/file-storage

    ChangeLog

    1.1.0

    • 使用打包工具进行重构

    使用

    import FileStorage from '@hbtv/file-storage';
     
     
    const fileName = 'users.json';
    const fileStorage = new FileStorage(fileName);
     
     
    // setItem
    fileStorage.setItem([
      { id: 1, userName: 'Donald' },
      { id: 2, userName: 'Paul' },
      { id: 3, userName: 'Mark' },
    ]);
     
    // getItem
    fileStorage.getItem();
     
    // create
    fileStorage.create({ userName:"John"});
     
    // update
    fileStorage.where({id:1}).update({ userName:"Jane"});
     
    // find
    fileStorage.where({userName:'Paul'}).find();
     
    // search
    fileStorage.search();
     
    // destroy
    fileStorage.where({id:1}).destroy();
     
    // orderBy
    fileStorage.orderBy('id','desc').search();
     
    // paginate
    fileStorage.orderBy('id','desc').paginate();
     

    Keywords

    none

    Install

    npm i @hbtv/file-storage

    DownloadsWeekly Downloads

    1

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    16.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • gegang
    • zix2002
    • yugong
    • dokey
    • gogoing
    • xuezhidp
    • aa719032411