Skip to content

katoy/fileupload

Repository files navigation

tarvis : Build Status

Usage

$ git clone https://github.com/katoy/fileupload.git
$ cd fileupload

$ npm install -g express
$ npm install -g jasmine-node
$ npm install -g vows

$ bundle install

$ cake 

$ cake setup 
$ cake clean
$ cake compile

$ cake epubcheck3
//  示された手順に従って、epub3 の checker を lib/epubcheck3 に配置する。

$ npm start
or    
$ cake run
or    
$ cake -p 3000 -e production run

Access http://localhost:3000/

$ cake test
// vows と zombie  で brouser からのアクセスでテストを行い、coverge計測も行う。




Description

express + coffeescript + connect_form で ファイルのアップロードを実装しています。 拡張子が .epub のファイルをアップロードした場合、アップロードしたファイル一覧ページから epub としての妥当性チェックをしたり、epub 中のファイルを閲覧することができます。

mobi ファイルを扱う場合は ebook-convert をインストールする必要があります。
ebook-convert: http://manual.calibre-ebook.com/cli/ebook-convert.html#
これは calibre のコマンドラインツールです。
ここ を参照してインストールしてください。

epub, movi, chm のファイル名に日本語が含まれている場合、express の middleware に patch を当てる必要があります。

ntsitm229197:middleware youichikato$ pwd
/Users/youichikato/github/fileupload/node_modules/express/node_modules/connect/lib/middleware
ntsitm229197:middleware youichikato$ diff -c directory.js~ directory.js
*** directory.js~	2012-11-10 01:31:28.000000000 +0900
--- directory.js	2013-02-10 00:49:14.000000000 +0900
***************
*** 117,123 ****
         .replace('{files}', html(files, dir, icons))
         .replace('{directory}', dir)
         .replace('{linked-path}', htmlPath(dir));
!       res.setHeader('Content-Type', 'text/html');
       res.setHeader('Content-Length', str.length);
       res.end(str);
     });
--- 117,123 ----
         .replace('{files}', html(files, dir, icons))
         .replace('{directory}', dir)
         .replace('{linked-path}', htmlPath(dir));
!       res.setHeader('Content-Type', 'text/html; charset=UTF-8');
       res.setHeader('Content-Length', str.length);
       res.end(str);
     });

TODO

  • ファイルチューザーで複数ファイルを選択出来るようにする。
  • Drag & Drop でもアップロードできるようにする。
  • ファイル種類により サムネイル、ファイルアイコンを表示するようにする。

See

次の記事を参考にした。

epub3 のサンプル

epub2 のサンプル

//--- End of File ---

About

file-upload using Express, coffeescript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages