Files
anydb/t/files.txtar
Thomas von Dein 1eb5efae0c finalized conversion to protobuf:
- fixed import+export
- generalized file options
- always store keys as lowercase
- fixed+enhanced docs
- fixed tests
2024-12-30 12:12:02 +01:00

52 lines
1.4 KiB
Plaintext

#
# Copyright © 2024 Thomas von Dein
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# simple file, we cannot use redirection here, so dd is our friend
exec dd if=/dev/random of=file.txt count=5 bs=10
# add file to db
exec anydb -f test.db set datum -r file.txt
# check for existence
exec anydb -f test.db get datum -o out.txt
exists out.txt
# check if its filled (50 bytes == count=5 x bs=10)
exec ls -l out.txt
stdout 50
# look if it's inside the db
exec anydb -f test.db ls
stdout datum.*binary-content
# do the same thing with text content, start with a new text entry
exec anydb -f test.db set feed alpha
# which we write to a file
exec anydb -f test.db get feed -o out2.txt
exists out2.txt
# check if its filled (5 bytes + newline)
exec ls -l out2.txt
stdout 6
# compare content
exec cat out2.txt
stdout alpha