ITPub博客

首页 > 数据库 > 数据库开发技术 > 【巨杉数据库Sequoiadb】在sdb shell中如何对文件追加写

【巨杉数据库Sequoiadb】在sdb shell中如何对文件追加写

原创 数据库开发技术 作者:CherylRAnthony 时间:2019-07-12 10:54:27 0 删除 编辑

【问题描述】 
在sdb shell中能否对已有文件进行追加写?

【解决方法】 
1、可以使用seek方式对已有的文件偏移到某个位置,使用write从偏移的位置开始写,比如: 
var file = new File("/opt/text.txt") //打开文件 

file.seek(0,'e') //表示当前file指针到文件末尾 
file.write("test") //表示从文件末尾开始写入“test” 
file.close //进行保存; 
2、seek(offset,where) ,offset:文件指针以字节为单位的偏移; where:规定开始计算的位置 ,where取值:‘b’、'c'、'e',分别代表Begin Current End; 
3、sdb shell中可以使用help方法查看相关用法,比如:new File("/opt/text.txt").help(); 
4、更多File的使用,请查看官方文档: 
http://doc.sequoiadb.com/cn/index-cat_id-1552034509-edition_id-302 。


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69935160/viewspace-2650325/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-06-25

  • 博文量
    71
  • 访问量
    55601