Minio.js 771 B

1234567891011121314151617181920212223242526272829
  1. // const Minio = require('minio')
  2. import * as Minio from './vite-minio/index.js'
  3. class MinioServer {
  4. constructor () {
  5. this._config = {
  6. // endPoint: '/alaa/minio',
  7. endPoint: 'https://stage-minio.alaatv.com',
  8. // port: 9000,
  9. // useSSL: true,
  10. accessKey: 'temp-upload',
  11. secretKey: 'X&d2UF4d78Ar*w#Y'
  12. }
  13. this._client = new Minio.Client(this._config)
  14. }
  15. upload (file) {
  16. const metaData = {
  17. 'Content-Type': 'application/octet-stream',
  18. 'X-Amz-Meta-Testing': 1234,
  19. example: 5678
  20. }
  21. this._client.fPutObject('temp-upload', 'test.png', file, metaData, function(err, etag) {
  22. if (err) return console.log(err)
  23. console.log('File uploaded successfully.')
  24. })
  25. }
  26. }
  27. export default MinioServer