asilvas / node-image-steam

A simple, fast, and highly customizable on-the-fly image manipulation web server built atop Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can we have access to Non image extension file?

patelmayankce opened this issue · comments

Currently i am trying to access PDF with params and it's not working.

if I am opening a PDF without passing params it works.

Working: uploads/tx_multishop/images/cmsfiles/61b9a1b55e1df.pdf
Not Working: uploads/tx_multishop/images/cmsfiles/61b9a1b55e1df.pdf?_gl=1*fpdze9

Configuration

const path = require('path');

module.exports = {
  imageStream: {
    http: [
      {
        port: process.env.PORT,
      },
    ],
    storage: {
      defaults: {
        driver: 'http',
        endpoint: process.env.IMAGE_ENDPOINT,
      },
      cache: {
        driver: 'fs',
        path: path.resolve(__dirname, '../storage/cache'),
      },
      cacheOptimized: {
        driver: 'fs',
        path: path.resolve(__dirname, '../storage/cacheOptimized'),
      },
      // cacheArtifacts: false,
      cacheTTS: process.env.CACHE_TTS || 600,
      cacheOptimizedTTS: process.env.CACHE_OPTIMIZED_TTS || 300,
      replicas: {
        otherPlace: {
          cache: {
            driver: 'fs',
            path: path.resolve(__dirname, '../storage/replica-cache'),
          },
          cacheOptimized: {
            driver: 'fs',
            path: path.resolve(__dirname, '../storage/replica-cacheOptimized'),
          },
        },
      },
    },
    processor: {
      sharp: {
        defaults: { animated: true, failOnError: false },
        cache: false,
      },
    },
  },
};

Please advice if is there anything i am missing in configuration?

Image-steam is designed for images. It's just a convenience that non-image files are proxied so long as no image instructions are provided.

Thanks @asilvas , It's working as expected for PDF but when i pass params it's not, so is there any way where we can fix it?

Thanks @asilvas , It's working as expected for PDF but when i pass params it's not, so is there any way where we can fix it?

PR welcome. Otherwise might be a while before I pick it up.