How to use is-gif - 1 common examples

To help you get started, we’ve selected a few is-gif 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 ywwhack / aidou-electron / src / renderer / common / imageManager.js View on Github external
try {
      const { data } = await this.imageData
      const reader = new FileReader()
      reader.readAsArrayBuffer(data)
      // 先将文件下载到本地
      const buffer = await new Promise(resolve => {
        reader.onloadend = () => {
          const buffer = Buffer.from(reader.result)
          const filePath = path.resolve(IMAGE_SAVE_DIR, filename)
          promisify(fs.writeFile)(filePath, buffer)
          resolve(buffer)
        }
      })
      // 拷贝到剪切板
      if (isGif(buffer)) {
        copyGif(filename)
      } else {
        clipboard.writeImage(nativeImage.createFromBuffer(buffer))
      }
    } catch (e) {
      console.error(e)
      // todo: error handler
    }
  }

is-gif

Check if a Buffer/Uint8Array is a GIF image

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular is-gif functions