Skip to content

Commit eb00bb2

Browse files
authored
Merge pull request #41 from queryverse/new-mime
Add support for 'application/vnd.dataresource+json' MIME type
2 parents 65ebaba + 8d2c2d9 commit eb00bb2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# CSVFiles.jl v0.14.0
2+
* Add support for 'application/vnd.dataresource+json' MIME type
3+
14
# CSVFiles.jl v0.13.0
25
* Never use StringVector, always use Vector{String} instead
36

src/CSVFiles.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ end
2828

2929
Base.showable(::MIME"text/html", source::CSVFile) = true
3030

31+
function Base.show(io::IO, ::MIME"application/vnd.dataresource+json", source::CSVFile)
32+
TableShowUtils.printdataresource(io, getiterator(source))
33+
end
34+
35+
Base.showable(::MIME"application/vnd.dataresource+json", source::CSVFile) = true
36+
3137
function Base.show(io::IO, source::CSVStream)
3238
TableShowUtils.printtable(io, getiterator(source), "CSV file")
3339
end
@@ -38,6 +44,12 @@ end
3844

3945
Base.showable(::MIME"text/html", source::CSVStream) = true
4046

47+
function Base.show(io::IO, ::MIME"application/vnd.dataresource+json", source::CSVStream)
48+
TableShowUtils.printdataresource(io, getiterator(source))
49+
end
50+
51+
Base.showable(::MIME"application/vnd.dataresource+json", source::CSVStream) = true
52+
4153
function fileio_load(f::FileIO.File{FileIO.format"CSV"}, delim=','; args...)
4254
return CSVFile(f.filename, delim, args)
4355
end

0 commit comments

Comments
 (0)