npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

easywyg-fileserver

v0.8.1

Published

Fileserver for Easywyg rich text editor. Allow to upload images from Easywyg editor and serve them

Readme

Easywyg Fileserver

Fileserver for Easywyg rich text editor. Allow to upload images from Easywyg editor and serve them.

Installation

npm install -g easywyg-fileserver

After installation, create config.yml somewhere in your filesystem and copy following configuration options into that file.

Example configuration

# ef-config.yml
server:
  host: example.com
  port: 12320
storage:
  root: '/var/www/example.com/uploads'
  path: 'uploads/%y/%m/%d'
  filename: '%name.%ext'
  maxFileSize: 5242880 # 5 megabytes
serve:
  enabled: false
  via: 'fileserver' # or 'webserver'
  # When serve via webserver
  xSendfileHeader: 'X-Accel-Redirect' # or X-Sendfile

Running server

$ easywyg-fileserver --config /path/to/ef-config.yml

or with ENV variable

$ EF_CONFIG=/path/to/ef-config.yml easywyg-fileserver

API

Upload image

$ curl -F "file=@/tmp/image.jpg" -X POST http://localhost:12320/upload

You will get JSON response from the server after upload image:

{
  "original":"image.jpg",
  "url":"http://localhost:12320/uploads/2016/03/13/bcb41a31-62a9-47ac-9aa3-d7e946318477.jpg",
  "size":131128,
  "mimetype":"image/jpeg"
}

Copy image from remote url

$ curl -X POST -d "url=https://www.google.ru/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" http://localhost:12320/copy

You will get JSON response from the server after copy image:

{
  "original":"googlelogo_color_272x92dp.png",
  "url":"http://localhost:12320/uploads/2016/03/13/aab33b54-62a9-47ac-9aa3-d7e946318477.jpg",
  "size":234865,
  "mimetype":"image/png"
}

Serve image

$ curl http://localhost:12320/uploads/2016/02/26/ae10175f-9a59-4998-8bea-4c5c4387ace7.jpg

Error handling

If any error occurs, you will get error response from the server and appropriate http status.

{
  "error":"File not found"
}

init.d script

Copy sample init.d script into /etc/init.d/easywyg-fileserver then configure it. After making necessary settings, execute following commands:

$ sudo chmod +x /etc/init.d/easywyg-fileserver
$ sudo update-rc.d easywyg-fileserver defaults

Now you can run/stop fileserver using service easywyg-fileserver start and service easywyg-fileserver stop.

Using Easywyg Fileserver behind Nginx. Serve files via Nginx.

Take the following configuration to use Nginx as a front-end proxy and Easywyg Fileserver as a back-end.

server {
    listen <YOUR_SERVER_IP>:80;
    server_name fileserver.example.com;

    location / {
        proxy_pass         http://127.0.0.1:12320/;
        proxy_redirect     off;

        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

        client_max_body_size       10m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;

        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;
    }

    location /serve/ {
       alias /home/example.com/shared/public/uploads/;
       internal;
    }
}

This Nginx configuration work together with following Easywyg Fileserver configuration:

# ef-config.yml
server:
  host: localhost
  port: 12320
storage:
  root: '/tmp'
  path: 'uploads/%y/%m/%d'
  filename: '%name.%ext'
  maxFileSize: 5242880 # 5 megabytes
serve:
  enabled: true
  via: 'webserver' # or 'fileserver'
  # When serve via webserver
  xSendfileHeader: 'X-Accel-Redirect' # or X-Sendfile