import SparkMD5 from 'spark-md5'

export default (file) => {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onload = () => {
      const spark = new SparkMD5.ArrayBuffer()
      spark.append(reader.result)
      resolve(spark.end())
    }
    reader.readAsArrayBuffer(file)
  })
}