lsjson: add MimeType to the output

This commit is contained in:
Nick Craig-Wood 2018-05-13 10:37:46 +01:00
parent f77efc7649
commit db4c206e0e

View file

@ -39,6 +39,7 @@ type lsJSON struct {
Name string Name string
Encrypted string `json:",omitempty"` Encrypted string `json:",omitempty"`
Size int64 Size int64
MimeType string `json:",omitempty"`
ModTime Timestamp //`json:",omitempty"` ModTime Timestamp //`json:",omitempty"`
IsDir bool IsDir bool
Hashes map[string]string `json:",omitempty"` Hashes map[string]string `json:",omitempty"`
@ -72,6 +73,7 @@ The output is an array of Items, where each Item looks like this
}, },
"ID": "y2djkhiujf83u33", "ID": "y2djkhiujf83u33",
"IsDir" : false, "IsDir" : false,
"MimeType" : "application/octet-stream",
"ModTime" : "2017-05-31T16:15:57.034468261+01:00", "ModTime" : "2017-05-31T16:15:57.034468261+01:00",
"Name" : "file.txt", "Name" : "file.txt",
"Encrypted" : "v0qpsdq8anpci8n929v3uu9338", "Encrypted" : "v0qpsdq8anpci8n929v3uu9338",
@ -126,6 +128,7 @@ can be processed line by line as each item is written one to a line.
Path: entry.Remote(), Path: entry.Remote(),
Name: path.Base(entry.Remote()), Name: path.Base(entry.Remote()),
Size: entry.Size(), Size: entry.Size(),
MimeType: fs.MimeTypeDirEntry(entry),
} }
if !noModTime { if !noModTime {
item.ModTime = Timestamp(entry.ModTime()) item.ModTime = Timestamp(entry.ModTime())