Skip to content

Instantly share code, notes, and snippets.

@JedWatson
Created April 11, 2016 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JedWatson/182a3eda34301cb19da310ad32f26919 to your computer and use it in GitHub Desktop.
Save JedWatson/182a3eda34301cb19da310ad32f26919 to your computer and use it in GitHub Desktop.
LocalFile Contents Scratch
{ fieldname: 'file',
originalname: 'Advanced example.md',
name: '1458848e82f2de780e5ad963d93606aa.md',
encoding: '7bit',
mimetype: 'text/markdown',
path: '/var/folders/ck/y02pffhs31xd_k4xc9xmn3hw0000gn/T/1458848e82f2de780e5ad963d93606aa.md',
extension: 'md',
size: 7703,
truncated: false,
buffer: null } }
dest: 'uploads',
filename (file) {
if (options.overwrite) return file.originalname;
return item.id + '-' + Date.now() + '-' + file.originalname;
}
format (value) {
return value.path.substr(value.path.lastIndexOf('/'));
}
href (value) {
return value.path.replace(/uploads/, 'files/uploaded');
}
uploads/me.jpg
thinkmill.com.au/files/uploaded/me.jpg
{
type: 'text/markdown',
filename: 'Advanced example.md',
path: 'uploads',
size: 7703,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment