Skip to content

Commit 3a0c3a8

Browse files
committed
initial support for rds aka RDataSingle format
1 parent 08873c4 commit 3a0c3a8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/registry.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ end
1818

1919
add_format(format"RData", detect_rdata, [".rda", ".RData", ".rdata"], [:RData, LOAD])
2020

21+
function detect_rdata_single(io)
22+
seekstart(io)
23+
res = read(io, UInt8) in (UInt8('A'), UInt8('B'), UInt8('X')) &&
24+
(c = read(io, UInt8); c == UInt8('\n') || (c == UInt8('\r') && read(io, UInt8) == UInt8('\n')))
25+
seekstart(io)
26+
return res
27+
end
28+
29+
add_format(format"RDataSingle", detect_rdata_single, [".rds"], [:RData, LOAD])
30+
2131
add_format(format"CSV", (), [".csv"], [:CSVFiles])
2232
add_format(format"TSV", (), [".tsv"], [:CSVFiles])
2333
add_format(format"Feather", "FEA1", [".feather"], [:FeatherFiles])

0 commit comments

Comments
 (0)